I have a VM running Ubuntu 10.10. I'm using Netbeans and uploading files to an ftp on the virtual machine. I'm using vsftpd.
The problem I'm having is, the owner of the folder /var/www
is the user apache
in order for the apache server to be able to read the files. So far so good.
But when I try to upload a file from ftp user user1
I'm not able to. I know what the problem is. My question is, how do I set up permissions correctly for the user apache
and user1
to be able to write/read all the files in /var/www directory?
Best Answer
Create a group
www-users
and make it the group owner of/var/www
. Then assign the usersapache
anduser1
to the group and set the permissons on the/var/www
directory to 775. This will allowuser1
and any other users in thewww-users
group to read and write to/var/www
; it will also make it easier to authorize other users to write to/var/www
— simply assign the user to thewww-users
group.Edit: The correct permissions on
/var/www
is 2775, which includes setgid so that files and directories inside/var/www
inherit the group ownership of/var/www
.