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

Allen Brown abrown at peak.org
Tue Aug 29 09:59:31 PDT 2006


Martin Kelly wrote:
> This looks like what I've been looking for. Your example includes 
> several things I've never seen before though. Could you explain those 
> portions in more detail?
> 
> Specifically, I've never seen the -F switch to ls. Secondly, in:
> chown kedwardk.kedwardk ed
> Is there a difference between . and : in that? Would this have been 
> equivalent?
> chown kedwardk:kedwardk ed

I think they are equivalent.  I have a habit of using ".", perhaps
dating to my days with HPUX and ksh.

> In the chmod, you did 2777... what does the 2 do that 777 doesn't? Then, 
> in the drwxrwsrwx, what does the s mean?

The 2 is the set guid bit for the directory.  It is what does the
magic.  777 is very open.  I didn't test whether I could close
down that hole.  I suggest you experiment to see how much openness
is still neede.

> I suppose my shell skills need a little working.
> 
> Thanks :).

Bash is a powerful language.  With all the commands at
its disposal it becomes very powerful.  But if there is one
thing I would recommend that everyone learn, it is regular
expressions.  The grep man page is a good place to start.
-- 
Allen Brown  abrown at peak.org  http://www.peak.org/~abrown/
   There is one thing I can promise you about the outerspace program:
   Your tax dollars will go farther. --- Wernher von Braun


> Allen Brown wrote:
> 
>> 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.


More information about the EUGLUG mailing list