2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/chmod

31 lines
787 B
Plaintext
Raw Normal View History

2020-06-01 11:27:54 +00:00
# chmod
# Change file mode bits
2020-06-01 11:27:54 +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
# 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
# Remove e[x]ecutable rights from the [g]roup.
2020-06-01 11:27:54 +00:00
chmod g-x file
# Give [a]ll users rights to [r]ead and e[x]ecute.
2020-06-01 11:27:54 +00:00
chmod a+rx file
# 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
# Remove all rights from [o]thers.
2020-06-01 11:27:54 +00:00
chmod o= file
# 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
# Set access rights using numeric (octal) form.
2020-06-01 11:27:54 +00:00
chmod 750 file
# 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---