Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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: kb.mediatemple.net/questions/1626/Using+SSH+keys+on+your+server –  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

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.