chmod
Change file permissions using symbolic or numeric modes.
Synopsis
chmod [options] mode file
Core Options
-RChange permissions recursively.
--reference=FILECopy permissions from another file.
u/g/o/aUser, group, others, all (symbolic mode).
+/-/=Add, remove, or set permissions.
Usage Examples
Numeric Mode
Set rwx for user, rx for group/others.
chmod 755 script.shSymbolic Mode
Add execute permission for user.
chmod u+x script.shRecursive
Make all files in a directory readable.
chmod -R a+r data/Setgid Bit
New files inherit group in a directory.
chmod g+s shared/Copy Permissions
Match permissions of another file.
chmod --reference=template.sh deploy.shBuilt for builders.