Change Permissions Based On File Or Directory
Posted:
Wednesday, March 14th, 2012Last modified:
Friday, March 27th, 2015The following bash commands can be used to change permissions based on whether the resource is a file or directory.
Recursively Set Permissions on Files Only
Starting with ./target_dir, change permissions to 644 on files only.
find ./target_dir -type f -exec chmod u=rw,g=r,o=r {} \;
Recursivey Set Permission on Directories Only
Starting with ./target_dir, change permissions to 755 on 'directories only.
find ./target_dir -type d -exec chmod u=rwx,g=r,o=r {} \;
References
Available Wiki Topics
The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.