Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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

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.

share|improve this answer
Now I'm not even able to connect to the FTP at all for any users by executing chmod 700 -r /etc/ command :( – Trimantra Software Solution Jul 17 '14 at 13:25
What user and directories did you set ownership for? – bleeves Jul 17 '14 at 17:26
I did it from Root as you have mentioned. Not I'm not even able to connect to my server using SSH – Trimantra Software Solution Jul 18 '14 at 8:15
It won't let you SSH in as root? Can you confirm you have set up the correct keys? Here is a good tutorial if you are not sure: – bleeves Jul 18 '14 at 13:40
No its not letting me in as a ROOT also. KEY is correctly saved in system – Trimantra Software Solution Jul 18 '14 at 14:17

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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