Change all files and folders permissions of a directory to 644/755
The easiest way is to do:
chmod -R u+rwX,go+rX,go-w /path/to/dir
which basically means:
to ch
ange file mod
es -R
ecursively by giving:
u
ser:r
ead,w
rite and eX
ecute permissions,g
roup ando
ther users:r
ead and eX
ecute permissions, but not-w
rite permission.
Please note that X
will make a directory executable, but not a file, unless it's already searchable/executable.
+X
- make a directory or file searchable/executable by everyone if it is already searchable/executable by anyone.
Please check man chmod
for more details.
See also: How to chmod all directories except files (recursively)? at SU
One approach could be using find:
for directories
find /desired_location -type d -print0 | xargs -0 chmod 0755
for files
find /desired_location -type f -print0 | xargs -0 chmod 0644