πΆοΈ Technique Card: Understanding Access Permissions on Linux
Unit 101 β Terminal Tigers π― | Rank: Shadow Recruit
ShadowNet Agency: Recruit Training File β Classified Level 1
π΅οΈ Intel Drop: Who Can Do What?
Every file in a Linux system has access permissions that control who can read, write, or execute it. These permissions are divided into three sets:
- π€ User (u) β The fileβs owner
- π§βπ€βπ§ Group (g) β Users in the same group as the file
- π Others (o) β Everyone else on the system
Each set can have three permissions:
Symbol | Meaning | Value |
---|---|---|
r |
Read (view) | 4 |
w |
Write (edit) | 2 |
x |
Execute (run) | 1 |
π’ The Numbers Game
Linux lets us use numbers to represent these permissions:
chmod 755 file.txt
Hereβs how it breaks down:
7
= 4 (r) + 2 (w) + 1 (x) βrwx
5
= 4 (r) + 0 (no w) + 1 (x) βr-x
- Another
5
for others βr-x
So chmod 755
means:
User: rwx
Group: r-x
Others: r-x
Try it out:
touch testfile
chmod 741 testfile
ls -l testfile
What do you see?
π§ͺ Investigating a File
Use this command to see file permissions:
ls -l filename
Example output:
-rwx--x--- 1 agentY evilagents 532 Apr 13 09:00 stealth_script.sh
Breakdown:
-rwx--x---
β permissionsagentY
β ownerevilagents
β group
π Whoβs in the Group?
To see who is in a group:
grep evilagents /etc/group
Or:
getent group evilagents
π§βπ» System vs User Accounts
- User accounts: Created for humans like you! They usually have home directories (e.g.,
/home/sr101
). - System accounts: Created for services, scripts, or stealthy purposes. They might not have a home directory or login shell.
Spot them in /etc/passwd
. A system account might look like this:
stealthsvc:x:999:998::/var/lib/stealthsvc:/usr/sbin/nologin
Notice the lack of a home and the non-login shell.
π§ Changing Permissions
Use chmod
to change file permissions:
sudo chmod 700 file.sh # Numeric version: rwx --- ---
Need help breaking it down? Use this memory tip:
Read = 4, Write = 2, Execute = 1
Add them up for the permissions you want!
π― Practice Drill
- Create a file with:
touch recruit_file
chmod 731 recruit_file
ls -l recruit_file
- Interpret what those numbers mean.
Keep your eyes open, recruits. Not every account on the system is what it seemsβ¦
Trust your tools. Decode the clues. Silence the threat.
β¬ οΈ Go to Mission 005: The Execution Key