rwx permissions and chmod
The nine rwx bits of the owner, the group and others, what they mean on a file and on a directory, symbolic and octal notation, chmod, and the setuid, setgid and sticky bits.
- 26 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- The numbers
- Scenarios
A few cards from the deck
Unix permissions: what is it?
Show the answer
Nine bits split into three triplets (owner, group, others) that say who may read (r), write (w) and execute (x) a file.
The system picks a single triplet: owner if you are the owner, otherwise group if you belong to it, otherwise others. An owner with no right is not rescued by the group triplet.
Which line does
ls -lshow after these commands?
```bash
touch f
chmod 754 f
ls -l f`-rwxr-xr---rwxrwxr---rwxr--r-x-r-xr-xrw-
Show the answer
-rwxr-xr--7 = 4+2+1 gives the owner
rwx, 5 = 4+1 gives the groupr-x, 4 gives othersr--.-rwxr--r-xwould be 745: the last two digits swapped.In octal notation, r is …, w is … and x is …: each digit is the sum of the triplet's permissions.
Show the answer
In octal notation, r is 4, w is 2 and x is 1: each digit is the sum of the triplet's permissions.
They are the powers of 2: one bit per permission. To read 6, find the sum: 4 + 2, so
rw-.chmod: what is it?
Show the answer
The command that changes a file's permissions, in symbolic notation (u, g, o, a with +, - or =) or in octal.
chmod u+x script.shadds x for the owner and leaves the rest alone;chmod 755 script.shsets all nine bits at once. Only the file's owner and root may change its permissions.