8
6
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?
Thanks, finding all useful info in the same post is nice:) – Orsiris de Jong – 2018-03-14T08:55:19.100
Great answer. Except apache isn't able to read the files after I upload something with
user1
I ran the following commands:chown -R apache:www-users /var/www
,usermod -g www-users apache
,usermod -g www-users user1
,chmod 775 /var/www
. Am I missing something? – Tek – 2011-04-07T17:22:37.297The umask may be set to deny read permissions from others; see if changing the umask helps. – bwDraco – 2011-04-07T21:51:47.233
Yep. That was part of it. – Tek – 2011-04-07T22:06:59.693
10Here are the steps in case any googlers need a hint.
1) set up vsftpd for umask 0027 (/etc/vsftpd.conf) [local_umask=0027]
2) create www-users group (groupadd www-users)
3) add user to group (usermod -a -G group user)
4) Set apache to run as www-users group (httpd.conf)
5) chgrp www-users /var/www
6) chmod 2775 /var/www
– Tek – 2011-04-07T22:09:00.4572Also, try adding setgid permission to the directory:
chmod g+s /var/www
. This will ensure that files and directories created inside the directory are owned by the group that owns the directory. – bwDraco – 2011-04-07T22:23:45.570Super awesome. Thanks a bunch @DragonLord =) Edit: I was about to use the chmod g+s until I read your edit. Step 6 I had already used permission 2775 so it looks like I'm good :) – Tek – 2011-04-08T00:02:29.473