Files
learning/Software Notes/linux/chmod.txt
T
2026-03-02 19:45:01 +02:00

44 lines
714 B
Plaintext

Symbolic mode:
chmod who-+=permission filename
"who-+=permission" section can be repeated for different combos with a comma ,
who:
u - user
g - group
o - other
a - all
permissions:
r - read
w - write
x - execute
X - execute only if the file is a directory or already has execute permission for some user
s - set user or group ID on execution (????)
t - sticky bit (????)
chmod u=rwx,g=rx,o-rwx filename
Number mode
chmod user_permission..group_permission..other_permission filename
0 <= permission <= 7
permissions:
>>> for i in range (8):
... print(i, bin(i))
...
0 0b000
1 0b001
2 0b010
3 0b011
4 0b100
5 0b101
6 0b110
7 0b111
n __rwx
chmod 754 filename
binary breakdown:
chmod 111 101 100 filename