VSFTP chroot not defaulting to home directory

VSFTP has some confusing configuration parameters

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list

Reading this you would think that in order to chroot all users you would just uncomment

chroot_local_user=YES

If you do when users login they are placed in / which isn’t desirable. Some forum posts suggest uncommenting local_root but it isn’t in my config file.

It isn’t ideal but the following works with the downside that you have to add users explicitly to the file. When users connect they are correctly placed in their home directories and cannot go up a level.

#chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list

Whilst this worked I found it annoying that my original effort didn’t work. I eventually got it to work with the following

chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
user_sub_token=$USER
local_root=/home/$USER
Advertisements

3 Responses to “VSFTP chroot not defaulting to home directory”

  1. richardyeo Says:

    This is one of the most read blog posts on my blog. Are people finding this post useful?

  2. Brian Says:

    Thank you for this! This is what i needed!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: