Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have a basic linux server setup (setup locally on my network with no outside access) and i wanted to FTP files to the /var/www directory. I have installed vsftpd and i have access to the server via FTP on another machine.

The problem i am having is the permissions on the directories and files uploaded are no the same as root, although i have setup a user with the admin user group which has root privileges. When i go to view the file i get a 403 Forbidden error.

What is the best way for me to set this up so the files i upload as the user wftp have the permissions of root.

I have followed this and this

Any help would be appreciated.

share|improve this question
up vote 0 down vote accepted

Your problem is not how you configure the software. You need to start with a permissions model which allows the right users to change files and the right users to read files.

First off, FTP is plain bad. Do not use it unless you have absolutely no choice in the matter AND you/your customers will not be disadvantaged by some third party getting access to all your data. That you can install a FTP daemon means that you do have a choice. While there are some very good HTTP based file managers out there, this is only a viable approach if it runs on a different server than content serving, and over HTTPS. Really the only sensible option is SCP/SFTP.

Regardless of which method you choose, the content should never be writeable by the webserver uid - if you need to provide upload functionality then these files should be stored outside the document root and access should be mediated by code to prevent injection. Set the permissions on the base directory to 777, and only modify the contents via the webserver.

If you only ever need a single user account to upload content then the solution is simple - just set umask u=rwx,g=rx,o=rx (i.e. 022)

The link you cited at describes what one person did - and they start off by admitting they didn't know what to do. The solution they came up with leaves a lot to be desired.

share|improve this answer
Thanks for the reply. I should have mentioned (now edited) that this is a local server and is only available over my local network, no one outside the network can get access, so i am not worried about it being a secure FTP. It is only being used as a staging server for myself. I will give the umask thing a go. – zizther Aug 13 '12 at 12:10
The umask worked, i used it on the .bashrc file – zizther Aug 13 '12 at 13:59

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.