chmod operation on directories / files

Jonathan McKeown jonathan at hst.org.za
Wed May 7 12:36:35 UTC 2008


On Wednesday 07 May 2008 13:56, Zbigniew Szalbot wrote:

> How do I chmod separately files and directories?
>
> If I use chmod -R 644 then it will go through all the subdirectories
> assigning everything 644 permissions, directories including.

Use the symbolic form for permissions and use X, which is true if any of the 
execute bits is currently set, or if the argument is a directory.

chmod -R =r,u+w,+X .

(set read for all, add user write, add all execute bits if required) should 
give you 644 on files, 755 on directories and executables.

Jonathan


More information about the freebsd-questions mailing list