We have a system that logs into an FTP server (vsftpd on Linux), uploads a file to the default directory it lands in (it doesn't CWD) and then exits. For reasons beyond the scope of this question, it would be a pain to modify the FTP client application to have it change directories.

The user account that performs the upload is not currently chrooted, but I would like to chroot the account to improve security. However, the top-level chroot directory can't be writable according to vsftpd. Dropping the file in a subdirectory would be fine, but the client application doesn't have an option to change directories after login.

Considering this, is it possible to have the account's initial directory set to something other than / if it is chrooted?

I have tried using the local_root option in vsftpd.conf, but that just chroots the user to the given directory, still starting them in / versus a subdirectory like /putfileshere/.

Only the one account will ever need to log into this FTP server if that helps.

  • try mount -o bind /from /to
    – djdomi
    Aug 8 '19 at 20:37
  • @djdomi I'm not sure I follow. Can you elaborate? Aug 8 '19 at 20:44
  • I don't see why you can't just ftp put file subdir ?
    – suspectus
    Aug 8 '19 at 20:46
  • @suspectus Because the FTP client is automated system and the only parameters I can set are the host name, port number, username and password. The file name is auto-generated and it doesn't change directories. Aug 8 '19 at 20:49
  • You can't set local_root in your vsftp.conf?
    – suspectus
    Aug 8 '19 at 21:03

My solution was to set allow_writeable_chroot=YES in vsftpd.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.