NOTE: Users are chrooted and their local_root is set to /srv/ftp.

Why vsftpd forces local chrooted users to have home directory? It will refuse to work if there is not any. And I've found the following in the code:

/* Always do the chdir() regardless of whether we are chroot()'ing */

What is the purpose of that? Why should one chdir shortly to home and then to local_root.

3 Answers 3


I'm guessing because it's useful for the user to start off in their home directory when they connect, instead of being dropped into / (or somewhere else) and having to cd into their home directory most of the time.

The home directory should be taken from /etc/passwd though, so you can set it to anything you like (it doesn't have to be /home/<username>). You could make it /tmp or even / if you wanted to.

  • Please see my comment to the other answer and note that I've added to the question. Jul 31, 2012 at 8:53

What good is a chroot for if it drops you to / by default? The purpose of chrooting users to their home directory is to prevent them wandering around elsewhere -- the lack of homedir would defeat that and be horribly error prone.

  • There is an option local_root which I'm using, so the users are chrooted there. The question is why to shortly change to home before this. Jul 31, 2012 at 8:51

A chroot simply changes the root folder of the directory tree, so you can't cd a folder up from that point. Somehow developers have assumed $home_folder should be the chroot and packaged the two config variables together. It might be the answer for more than half of the ftp users out there, but for many it's not.

What if you want /home/$DOMAIN to be the chroot (local_root) and /home/$DOMAIN/$USER to be the landing folder? Then I would be told I am a special case or small majority that doesn't get to use vsftpd. Ethically, local_root should only be chroot and have nothing to do with where the user lands when logging in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .