Ubuntu – Create FTP users with limited access only to home directory Ubuntu 12.04

12.04permissionsrootvsftpd

I'm having Ubuntu 12.04 server and I have installed VSFTPD service for FTP.

I'm trying to create a FTP user who has access only to /var/www/ directory and all permissions for sub-directories.

FTPUser should not have access to any root / top level directories and files.

So far I have done following things.

  • I have created User called FTPUser1
  • I have changed the Home directory for FTPUser1 to /var/www/
  • I have edited /etc/vsftpd.conf file and have set chroot_local_user=YES
  • Restarted vsftpd service

After doing all these, My FTPuser1 still able to access top level directories and files.

Please let me know, How I can block top level access?

Best Answer

(Not sure why a question from 2014 pops up again on the homepage, but anyway :D )

It's probably not a good idea to mess with the overall permissions of the rest of the file system, like it has been suggested in the other answer. A better way would be to use a feature called "chroot".

"chroot", short for "change root", just does that: It changes the root of the directory tree the (FTP) user can acccess to what the admin wants it to be. Sometimes the same feature is referred to as "jailing" the user in their home directory.

Most FTP servers support chroot (with the exception of some very small, bare-bone ones). I'm not really familiar with vsftpd, but according to this how-to on Cybercity you need to set the config directive chroot_local_user to 1.

Related Question