I have a VSFTPD setup in which users are chrooted to their home directories. Standard stuff. But this requires all of their home directories to be unwritable to them (to avoid security issues.) No problem, if they want to upload files they can upload them to a writable folder within their chroot.
But now they have to change into that folder every time to do their uploading. If I use the local_root option in the VSFTPD config file to move their default login location to that writable folder, then that becomes their chroot, and we're back to square one: it cannot be writable.
My question is, how can I move the default location that VSFTPD puts users in, to a writable directory within their chroot jail, without making the chroot directory itself writeable?
There is only one way to do this with vsftpd and paths must be set in the system passwd file. Paths cannot be set in the vsftpd.conf file.
In the /etc/vsftpd.conf file, set the following two options:
You must also change the user's unix home directory to indicate where the chroot jail is rooted. The chroot jail root will be located at the path left of the
/./
in the home directory path. i.e./ftphome/./home/user/
would set the chroot jail to/ftphome/
and inside the jail the user directory would behome/user
. You can do this by executing:Obviously, the chroot directory and user directories inside should be setup per normal chroot preparation.