[wellylug] Chmod settings for web directory?

Ewen McNeill ewen at naos.co.nz
Thu May 1 11:39:32 NZST 2003


In message <1051745608.3eb05d48d2755 at www.paradise.net.nz>, Stephen Judd writes:
>In a docroot with a bunch of directories, is there a way to recursively set 
>them up such that their contents are read-only but directories have execute as 
>well? 

find /path/to/directory -type d | xargs chmod a+rx
find /path/to/directory -type f | xargs chmod a+r

>(I mean in one or two commands, as opposed to writing a script). It is 
>damned inconvenient by hand...

I don't know if you consider the above "inconvenient by hand"; it's what
I usually do, and I often do it by hand (largely 'cause it'd take me
longer to remember what I called a magic script to do it than it takes
just to type it in again).

BTW, if you've got funky filenames with spaces in them, you'll:
(a) need GNU find and xargs (in most Linux distributions); and
(b) need to use -print0 and -0 for find and xargs respectively (see the
    man pages)

Ewen



More information about the wellylug mailing list