2014-10-02 03:39:28 +01:00
|
|
|
# chmod
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Change the access permissions of a file or directory.
|
2021-03-29 22:28:18 +02:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html>.
|
2014-10-02 03:39:28 +01:00
|
|
|
|
2016-08-30 11:47:11 -05:00
|
|
|
- Give the [u]ser who owns a file the right to e[x]ecute it:
|
2014-10-02 03:39:28 +01:00
|
|
|
|
|
|
|
`chmod u+x {{file}}`
|
|
|
|
|
2020-01-11 17:10:48 -05:00
|
|
|
- Give the [u]ser rights to [r]ead and [w]rite to a file/directory:
|
2014-10-02 03:39:28 +01:00
|
|
|
|
2019-02-08 01:31:19 +01:00
|
|
|
`chmod u+rw {{file_or_directory}}`
|
2014-10-02 03:39:28 +01:00
|
|
|
|
2020-01-11 17:10:48 -05:00
|
|
|
- Remove e[x]ecutable rights from the [g]roup:
|
2014-10-02 03:39:28 +01:00
|
|
|
|
|
|
|
`chmod g-x {{file}}`
|
|
|
|
|
2020-01-11 17:10:48 -05:00
|
|
|
- Give [a]ll users rights to [r]ead and e[x]ecute:
|
2014-10-02 03:39:28 +01:00
|
|
|
|
|
|
|
`chmod a+rx {{file}}`
|
|
|
|
|
2020-01-11 17:10:48 -05:00
|
|
|
- Give [o]thers (not in the file owner's group) the same rights as the [g]roup:
|
2014-10-02 03:39:28 +01:00
|
|
|
|
|
|
|
`chmod o=g {{file}}`
|
2017-11-24 09:01:12 -05:00
|
|
|
|
2020-01-11 17:10:48 -05:00
|
|
|
- Remove all rights from [o]thers:
|
|
|
|
|
|
|
|
`chmod o= {{file}}`
|
|
|
|
|
2020-10-27 10:00:32 +03:30
|
|
|
- Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
|
2017-11-24 09:01:12 -05:00
|
|
|
|
2017-11-29 19:05:58 -05:00
|
|
|
`chmod -R g+w,o+w {{directory}}`
|