Configure user vsftpd in a specific directory

Hello friends!

I am beginner and installed the LAMP package in Ubuntu, but I can not make the following settings:

I created a user named “oregon” and want to access SFTP with it, but I need that he has as root directory** /var/www** because I will publish your site files in /var/www/html. Also not want him to see above directories and preference.

Already asked for help in supporting and read the tutorials, but could not solve :(

Every moment is a different problem, I can never complete this setting, please help me.


hi i have question, why my local user in debian 7.8 can’t login ftp, but just account root can login in my ftp server.

im using vsftpd server

please answer my question!!!

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can’t or you can? It sounds like you can. Anyway, it seems that you got a permissions problem now. You can check it with:

ls -l /var/www

You can read more about them here: FilePermissions I believe that apache (www-data) isn’t the owner of your html directory, and your user isn’t in this group either, thus you need to allow “Others” to read and execute or no one will be able to access the site. The classic permissions for sites are 755 for folders and 644 for files.

P.s.: Accidentally posted this as an answer instead of a reply to your new answer. Dang.



I tested your tip and now can not send files to the server, the only problem is that no page or directory is accessible, to make the browser via access displays the following message:


You don’t have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at Port 80

@Woet I am a novice, do not know what I’m doing. What do I need at the moment is: access the FTP or SFTP with the user created. As you would with handles sshd SFTP?

@redraenhys Thank you, I will perform this procedure when I was at home.

You could bind the user folder to the /html. 1. To keep it tidy create a folder in the user’s folder: mkdir -p /home/{user}/www/html where {user} should be changed to the user name. Also create the html folder in /var/www if it doesn’t exist yet.

2. Then to mount it: mount --bind /var/www/html /home/{user}/www/html

You’re basically binding these folders, as the docs states: “–bind Remount a subtree somewhere else (so that its contents are available in both places)”

3. You’ll still need to make it permanent, so: sh -c 'echo "/var/www/html /home/{user}/www/html none defaults,bind 0 0" >> /etc/fstab'

which is the equivalent to add the bind command to the /etc/fstab, so it’s executed every time your system boots.

Are you using FTP or SFTP? As far as I know, vsftpd does not support SFTP.