chmod
Change the access permissions of a file or directory.
More information: https://www.gnu.org/software/coreutils/chmod.
- Give the user who owns a file the right to execute it:
chmod u+x path/to/file
- Give the user rights to read and write to a file/directory:
chmod u+rw path/to/file_or_directory
- Remove executable rights from the group:
chmod g-x path/to/file
- Give all users rights to read and execute:
chmod a+rx path/to/file
- Give others (not in the file owner’s group) the same rights as the group:
chmod o=g path/to/file
- Remove all rights from others:
chmod o= path/to/file
- Change permissions recursively giving group and others the ability to write:
chmod -R g+w,o+w path/to/directory
- Recursively give all users read permissions to files and eXecute permissions to sub-directories within a directory:
chmod -R a+rX path/to/directory