3

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?

  • Have you removed public read/write/execute permissions from your top level directories? – bleeves Jul 17 '14 at 12:24
  • Not yet. I'm new to Ubuntu Terminal. – Trimantra Software Solution Jul 17 '14 at 12:28
1

(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.

0

As the owner/root, execute:

chmod 700 -r [directory]

700 means that only the owner has full access, -r means to apply the rules to subfolders. You will also want to:

chown user:user -r [/path/to/dir]

The chown command changes the owner. user: is the username to that will become owner; the :user is the group.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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