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
Best Answer
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 iswww-data
. Make sure all the users who need write access to/var/www
are in this group.Then set the correct permissions on /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 thewww-data
group.Find all files in
/var/www
and add read and write permission for owner and group: