Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2008 14:38:40 +0200
From:      Jonathan McKeown <jonathan@hst.org.za>
To:        freebsd-questions@freebsd.org
Subject:   Re: chmod operation on directories / files
Message-ID:  <200805071438.40372.jonathan@hst.org.za>
In-Reply-To: <482198FA.8070708@lc-words.com>
References:  <482198FA.8070708@lc-words.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805071438.40372.jonathan>