2020-06-01 11:27:54 +00:00
|
|
|
# chmod
|
2020-10-20 23:13:05 +00:00
|
|
|
# Change file mode bits
|
2020-06-01 11:27:54 +00:00
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Give the [u]ser who owns a file the right to e[x]ecute it.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod u+x file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Give the [u]ser rights to [r]ead and [w]rite to a file/directory.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod u+rw file_or_directory
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Remove e[x]ecutable rights from the [g]roup.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod g-x file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Give [a]ll users rights to [r]ead and e[x]ecute.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod a+rx file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Give [o]thers (not in the file owner's group) the same rights as the [g]roup.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod o=g file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Remove all rights from [o]thers.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod o= file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Change permissions recursively, allowing [g]roup and [o]thers to [w]rite.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod -R g+w,o+w directory
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Set access rights using numeric (octal) form.
|
2020-06-01 11:27:54 +00:00
|
|
|
chmod 750 file
|
|
|
|
|
2020-10-20 23:13:05 +00:00
|
|
|
# Convert string representation of the access right into numeric form and back.
|
2020-06-01 11:27:54 +00:00
|
|
|
curl cheat.sh/chmod/750
|
|
|
|
curl cheat.sh/chmod/rwxr-x---
|