[Eug-lug] Correct Apache User and Group for easy editing

Allen Brown abrown at peak.org
Sun Aug 27 17:26:17 PDT 2006


I had a vague memory that setting the directory's suid or guid
bit would cause the file to take on the directory's ownership.
But I can't find the documentation for it.  Anyway, I just
tried it and it works.  This might solve your problem.

$ mkdir ed; ls -dFl ed
drwxr-xr-x  2 abrown users 1024 2006-08-27 17:17 ed/

$ sudo bash
# chown kedwardk.kedwardk ed
# chmod 2777 ed; ls -dFl ed
drwxrwsrwx  2 kedwardk kedwardk 1024 2006-08-27 17:17 ed/

$ touch ed/a; ls -Fl ed/.
total 0
-rw-r--r--  1 abrown kedwardk 0 2006-08-27 17:19 a

That was for group.  You should be able to get user forcing
if you want.
-- 
Allen Brown  abrown at peak.org  http://www.peak.org/~abrown/
   The world rewards action.  It doesn't reward much of anything else.
     --- Scott Adams

Martin Kelly wrote:
> I've been having a problem with my Apache setup in that I'm not sure 
> what user I should run it under. The default is www-data, and I could 
> just add myself to the www-data group and be able to edit it under my 
> user (martin). The problem with that is that when I create files with my 
> normal user, they will be owned by martin and thus inaccessible to 
> Apache. I could just edit the files with the www-data user, but that is 
> annoying in terms of syncing together various files (.vimrc and such) 
> between /home/martin and /home/www-data.
> 
> I attempted to have Apache run under the user martin by adding the 
> following in my Apache config:
> 
> User martin
> Group martin
> 
> but when I try to have a script create a directory, for example, it 
> returns "Permission Denied." This is Apache 2.0.55.
> 
> Does anybody have a good solution for this? For example, is there a way 
> to make all files created by me in /var/www owned by www-data instead?
> 
> Thanks all.
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
> 



More information about the EUGLUG mailing list