File permission question

Kevin D. Kinsey, DaleCo, S.P. kdk at daleco.biz
Fri Nov 14 21:00:15 PST 2003


How Can ThisBe wrote:

> Hi, I've just noticed a small issue, which I'm sure others are aware of.
>
> For apache to server users webpages, apache need to be able to read files
> and directories. So we have something like the following (by default) on
> FreeBSD;
>
> tigger at piglet:~% ls -Al ./ public_html/index.php | grep pub
> -rw-r--r--  1 tigger  tigger  16 Mar 24  2002 public_html/index.php
> drwxr-xr-x  12 tigger  tigger       512 Aug 14 02:04 public_html/
>
> However, the following set-up is a little more secure (users can not read
> other users includes files for a start) and works fine;
>
> tigger at piglet:~% ls -Al ./ public_html/index.php | grep pub
> -rw-r-----  1 tigger  www     16 Mar 24  2002 public_html/index.php
> drwxr-x---  12 tigger  www          512 Aug 14 02:04 public_html/
>
> My question is, when I make a new file or directory in ~/public_html 
> (with
> chown tigger:www), the file is made with the following permission:
>
> -rw-r--r--  1 tigger  www      0 Nov 15 13:42 public_html/test1.php
>
> How can I make new files without the world readable flag set, within the
> public_html directory?
>

Change your umask.





More information about the freebsd-questions mailing list