Module 2 · Linux you will actually use · Lesson 9 of 16
Permissions, sudo and services
How Linux decides who can read a file, what SUID means, how sudo works, and how to control packages and services.
In this lesson · about 25 minutes
- Read rwx permissions and convert them to numbers
- Explain why a SUID-root program matters to a tester
- Use sudo, sudo -l, apt and systemctl correctly
Every file has an owner, a group and three sets of permissions: for the owner, the group and everyone else. ls -l shows them:
-rw-r----- 1 root shadow 1458 Nov 20 08:12 /etc/shadow
| Part | Means |
|---|---|
| - | A regular file (d would be a directory) |
| rw- | Owner (root) can read and write |
| r-- | Group (shadow) can read |
| --- | Everyone else: nothing |
| root shadow | The owner and the group |
As numbers, read = 4, write = 2, execute = 1, added per set: rw-r----- is 640. chmod 640 file sets that, and chmod u+x script.sh adds execute for the owner.
Whiteboard · watch and try
Same file, two users, and how sudo works
Press Play. Two short stories: who can read /etc/shadow, and what sudo really does.
Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.
Users and sudo
whoami and id tell you who you are and which groups you are in. /etc/passwd lists accounts and is readable by everyone; the password hashes live in /etc/shadow. sudo runs one command as root, and sudo -l lists what you are allowed to run that way.
Packages and services
sudo apt updatethensudo apt install <name>installs software;apt searchfinds it.sudo systemctl status sshshows a service;start,stop,enableanddisablecontrol it.ss -tlnplists programs listening for connections on your machine. Check it before and after installing tools, so you know what you are exposing.
Check your understanding0 of 4 correct
Quiz score: 0 of 4
For authorized, lab-based learning only. Tana Roasters and every person, address and password in this course are fictional. Every terminal is simulated. "Kali Linux" is a trademark of OffSec; this course is not affiliated with or endorsed by OffSec.