Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 user named 'user' which I use to login to the ftp of my website.

However, this presents me with a problem.

If I want to allow my user to access to ftp, I have to typ the following:

chown -R user:ftpusers /var/www/

By doing this, my website is no longer available when surfing to it. To make it available again, I have to typ the following command:

chown -R www-data:www-data /var/www/

the user 'user' is in both the ftpusers and www-data group. How can I fix this so I wouldn't have to typ this anymore?

I'm using apache2 and vsftpd on ubuntu

share|improve this question

migrated from Jan 3 '12 at 13:20

This question came from our site for professional and enthusiast programmers.

chown www-data:ftpusers, perhaps? – Piskvor Jan 3 '12 at 12:46
By doing that, the website works, but the ftp fails – SnIpY Jan 3 '12 at 12:51
SnIpY: You may need chmod g+w to add group write permissions. – Piskvor Jan 3 '12 at 12:58
up vote 1 down vote accepted

To best share with multiple users who should be able to write in /var/www, it should be assigned a common group. For example the default group for web content on Ubuntu and Debian is www-data. Make sure all the users who need write access to /var/www are in this group.

sudo usermod -a -G www-data <some_user>

Then set the correct permissions on /var/www.

sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www

Additionally, you should make the directory and all directories below it "set GID", so that all new files and directories created under /var/www are owned by the www-data group.

sudo find /var/www -type d -exec chmod 2775 {} \;    

Find all files in /var/www and add read and write permission for owner and group:

sudo find /var/www -type f -exec chmod ug+rw {} \;
share|improve this answer

Your Answer


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