01 / 20

User & File System
Privileges

Understand how users, groups, and permissions control access to files and directories: the foundation of every secure system.

Cyber Security

Why Access Control Matters

Every operating system must answer a fundamental question: who is allowed to do what? Without access controls, any user could read, modify, or delete any file on the system: including passwords, financial records, and system configurations.

Understanding Users & Groups

User
An individual identity (account) on the system, identified by a unique UID (User ID).
Group
A collection of users sharing the same access rights, identified by a unique GID (Group ID).
Root / Admin
A superuser account with unrestricted access to all files and commands. UID = 0 on Linux.

The Access Hierarchy

root (UID 0) Group: devops Group: finance Group: hr alice bob carol dave Others (everyone else)

The Permission Triad: Read, Write, Execute

r : Read
Files: view contents. Directories: list filenames inside.
w : Write
Files: modify or delete contents. Directories: create or remove files.
x : Execute
Files: run as a program. Directories: enter the directory (cd into it).

Reading a Permission String

- r w x r - x r - - File Type Owner (rwx) Group (r-x) Others (r--) Owner: full access | Group: read + execute | Others: read only "-" at position 1 means this is a regular file (not a directory)

Octal Notation: The Numeric Shorthand

Each permission bit has a numeric value. The three permission bits for each entity are summed into a single digit:

Permission Symbol Value
Readr4
Writew2
Executex1
None-0

Authentication vs Authorization

Aspect Authentication Authorization
QuestionWho are you?What can you do?
WhenLogin / sign-inAfter identity is confirmed
MechanismPasswords, biometrics, MFAPermissions, ACLs, roles
AnalogyShowing your ID at the doorBeing allowed into specific rooms

Special Permission Bits

SUID
Set User ID: file executes with the owner's privileges, not the runner's. Example: passwd command.
SGID
Set Group ID: file executes with the group's privileges. On directories, new files inherit the group.
Sticky Bit
On directories, only the file owner (or root) can delete files: even if others have write access. Example: /tmp.

Beyond Basics: Access Control Lists

Standard Unix permissions are limited to one owner, one group, and others. Access Control Lists (ACLs) extend this by allowing fine-grained rules for specific users or groups beyond the file's owner/group.

report.pdf Standard Permissions owner: rw- | group: r-- | other: --- ACL: user:carol rw- (read + write) ACL: group:audit r-- (read only) carol gets write access without being in the file's group audit group gets read-only via a separate ACL entry

How to Set Permissions: Step by Step

1
Identify the file or directory. Use ls -l to see current permissions, owner, and group.
2
Decide who needs access. Determine if the target is the owner, a group, or others.
3
Choose the permission level. Apply read, write, and/or execute as needed.
4
Use chmod to apply. Symbolic mode: chmod u+x file. Octal mode: chmod 750 file.
5
Verify with ls -l. Confirm the new permission string matches your intent.

Example 1: Decoding a Permission String

d r w x r - x - - - directory
Owner: \(\texttt{rwx}=7\)
Group: \(\texttt{r-x}=5\)
Others: \(\texttt{---}=0\)
Octal: 750

Example 2: Changing Permissions

Scenario: You have a script called deploy.sh with current permissions -rw-r--r-- (644). You need to make it executable by the owner only.

1
Current state: rw- | r-- | r-- = Owner can read/write, everyone else can only read.
2
Goal: Add execute for owner only. New permission: rwx | r-- | r--
3
Symbolic: chmod u+x deploy.sh : adds execute to user (owner) only.
4
Octal: chmod 744 deploy.sh : \(7 = 4+2+1\), \(4 = 4+0+0\), \(4 = 4+0+0\).

Example 3: Shared Directory Setup

Scenario: A team needs a shared folder where everyone can add files, but no one except the file creator (or root) can delete others' files.

/shared/ drwxrwxrwt (1777) rwx for all (777) Sticky bit (t) Only owner deletes

Common Mistakes to Avoid

✕ chmod 777 everything
Giving full permissions to all users destroys security. Only use when absolutely necessary, never on sensitive files.
✕ Running as root
Using the root account for everyday tasks means any mistake or malware has unlimited system access.
✕ Ignoring group design
Adding users directly to files instead of using groups makes permission management messy and error-prone at scale.

Summary: Permissions at a Glance

Octal Symbolic Meaning Use Case
755rwxr-xr-xOwner: full, others: read + execPublic executables
644rw-r--r--Owner: read/write, others: readConfig files, documents
700rwx------Owner: full, others: nonePrivate scripts, SSH keys
600rw-------Owner: read/write, others: noneSensitive data files
1777rwxrwxrwtAll: full + sticky bitShared /tmp directories

Question 1 of 5

A file has the permission string -rw-r-----. What octal value does this represent?

Question 2 of 5

Which special permission bit allows a program to execute with the file owner's privileges regardless of who runs it?

Question 3 of 5

The principle of least privilege states that a user should have:

Question 4 of 5

On a Linux system, the /tmp directory typically has permissions 1777. What does the leading 1 indicate?

Question 5 of 5

Which command would give the owner read/write/execute, the group read/execute, and others no access to a file?