Using VSFTP to CHROOT a user to other than their home directory?

Hello everybody!

I have set up VSFTP on my server to CHROOT users to their home directory.  But how can I set it up so that they can CHROOT into another directory such as '/var/www' so they can edit a website.  I know I can change their home directory to '/var/www' but is there a way for VSFTP to chroot them on the fly?  I can't find a setting for that.  Thanks.
Who is Participating?
suggestionstickConnect With a Mentor Commented:

you could try using the "user_config_dir" option and setup a separate configuration file just for this user
 check out
Man vsftpd.conf 5

or you could try {Note: not sure how this works if /var/www is already mounted for partitioning}
mount --bind /var/www /home/user/www
this will allow /var/www to be access via the www folder in their home folder

umount /var/www
to unmount

VSFTP locks users to their home directories only.  There are no configuration options to specify that user1 should be locked to /var/www, but user2 should be locked to /home/user2

vsftpd reads the passwd file in /etc/ to obtain this information.  Sorry it can not be done at this stage.
Well can't be done without modifying their home directory location in /etc/passwd
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.