[UPHPU] recursively set directories and files different permissions

herlo1 at gmail.com herlo1 at gmail.com
Wed Jan 9 23:35:00 MST 2008


Wade, absolutely you can.

The answer lies within find

find /path/to/change -type d -exec chmod u=rwx,go=rx {} \;
find /path/to/change -type f -exec chmod u=rw,go=r {} \;

Cheers,

Clint

On 1/9/08, Richard K Miller <richardkmiller at gmail.com> wrote:
>
> On Jan 9, 2008, at 6:54 PM, Wade Preston Shearer wrote:
>
> >> My understanding is that the default permissions for directories
> >> are 0755 and for files 0644, which turns on execution for
> >> directories but not files. If you need to change the defaults, you
> >> use the umask:
> >
> > Thanks. Yes, that makes sense now (with past experience and the
> > tests I have been running). Being reminded of that, I went and ran
> > some more tests and it turns out that there is something else that
> > confuses me. None of the files (even the ones that I want to be
> > executable) are executable. I thought that a script file (such as
> > one containing PHP code) had to be executable in order to be served
> > up. Does the executable permission only apply to executing things
> > from the command line and not what Apache can and cannot serve?
>
> If it's Apache + mod_php, execute permissions are not required. (If
> it's Apache + CGI PHP, they are.)
>
> The command line can go both ways too:
>
> This requires execute permission and the file must begin with an
> appropriate hash-bang such as #!/usr/bin/php :
> $ ./myphpfile.php
>
> This does not require execute permission:
> $ /usr/bin/php myphpfile.php
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>


More information about the UPHPU mailing list