chmod / files and directories

Daniel Bye freebsd-questions at slightlystrange.org
Mon Sep 10 09:06:14 PDT 2007


On Mon, Sep 10, 2007 at 05:56:12PM +0200, Zbigniew Szalbot wrote:
> Hello,
> 
> I did read man chmod but I am not really wiser. Is there an option to
> recursively set 755 permissions for directories and 644 for files?
> When I just issue
> chmod -R 755 /usr/local/www/data/wp/
> then all files and directories under wp/ are given permissions 755
> which is not what I want.
> I can do it manually but since there are manyt subdirectories I
> thought I would make my life easier. Many thanks in advance!

find(1) is your friend here:

 # find . -type d -exec chmod 755 {} \;
 # find . -type f -exec chmod 644 {} \;

Dan

-- 
Daniel Bye

PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070910/6739c3e3/attachment.pgp


More information about the freebsd-questions mailing list