Study guide

5.3 Managing File Permissions and Ownership

LPI Linux Essentials Certificate 010-160

Track your progress as you read

Finished sections get a check mark.

1 Introduction & Exam Overview

1.1 Current Exam Facts 1.2 Study Strategy & Blueprint Weights

2 Topic 1: The Linux Community and a Career in Open Source

1.1 Linux Evolution and Popular Operating Systems 1.2 Major Open Source Applications 1.3 Open Source Software and Licensing 1.4 ICT Skills and Working in Linux

3 Topic 2 Part A: Command Line Basics & Getting Help

2.1a Bash Shell, Command Syntax & Variables 2.1b Quoting, History & Safe Command Syntax 2.2 Using the Command Line to Get Help

4 Topic 2 Part B: Directories, Listing & File Operations

2.3 Using Directories and Listing Files 2.4 Creating, Moving and Deleting Files

5 Topic 3 Part A: Archiving & Searching Data

3.1 Archiving and Compression on the Command Line 3.2a Pipes, Redirection, and Basic Regular Expressions 3.2b grep and Text Extraction Tools

6 Topic 3 Part B: Turning Commands into Scripts

3.3a Script Basics: Shebang, Variables, and Arguments 3.3b Loops, Exit Status, and Simple Conditionals 3.3c Editors, chmod +x, and Running Scripts

7 Topic 4 Part A: Choosing an OS, Hardware & FHS Basics

4.1 Choosing an Operating System 4.2 Understanding Computer Hardware 4.3a Where Programs and Configuration Live (FHS Basics)

8 Topic 4 Part B: Processes, Logs & Networking

4.3b Processes, Memory & Logs 4.4 Your Computer on the Network

9 Topic 5: Security and File Permissions

5.1 Basic Security and Identifying User Types 5.2 Creating Users and Groups 5.3 Managing File Permissions and Ownership 5.4 Special Directories and Files

5.3 Managing File Permissions and Ownership

Key Takeaways Explain This Topic AI

ls -l shows type, mode bits, owner, group, size, and name; ls -a also reveals hidden names starting with a dot

Permission bits are read (r), write (w), and execute (x) for user (u), group (g), and others (o)

chmod changes mode bits with symbolic forms (u+x) or octal forms (755); chown changes owner and optionally group

Common modes: 755 for executable programs/directories, 644 for ordinary shared files, 600 for private files

Execute permission on a directory means you may traverse/enter it; read lets you list names when listing is allowed

Last updated: July 2026

5.3 Managing File Permissions and Ownership

File permissions are the everyday security mechanism every Linux user touches. Topic 5.3 expects you to read a long listing, decode rwx triplets, and change modes and ownership with chmod and chown .

  • Reading ls -l and ls -a ls -l
  • ls -a
  • ls -la
  • Command What you gain
  • ls -l Long format: mode, links, owner, group, size, timestamp, name
  • ls -a Includes hidden entries (names starting with . )
  • ls -la Both: long listing including hidden files

A long line looks like:

-rw-r--r-- 1 alice developers 1200 Jul 23 09:15 report.txt

Break down the mode field -rw-r--r-- :

  • Characters Meaning
  • 1st ( - ) File type: - regular file, d directory, l symlink
  • 2–4 ( rw- ) User/owner permissions
  • 5–7 ( r-- ) Group permissions
  • 8–10 ( r-- ) Others permissions

So report.txt is a regular file: owner can read/write; group and others can read only.

Meaning of r, w, and x

  • Bit On a regular file On a directory
  • r (read) Read file contents List directory entries
  • w (write) Modify/truncate file Create/delete/rename entries inside (sticky bit in 5.4 can restrict deletes)
  • x (execute) Run as a program/script Traverse/enter the directory ( cd through it)

For directories: x = enter/traverse , w = change contents , r = list names . Missing execute on a directory blocks cd even if file modes inside look open.

Classes: user, group, others

  • Shorthand Class Who it matches
  • u User (owner) The file’s owner UID
  • g Group Users in the file’s group GID
  • o Others Everyone else
  • a All u+g+o in symbolic mode

Linux checks owner first , then group , then others . If you are the owner, your access comes from the owner bits—even if you are also in the group.

  • chmod : symbolic mode chmod u+x script.sh # add execute for owner
  • chmod go-w notes.txt # remove write from group and others
  • chmod a+r readme.md # everyone may read
  • chmod u=rwx,go=rx appdir # set exact bits for a directory
  • Operator Effect
  • + Add permissions
  • Remove permissions
  • = Set exactly (replaces that class’s bits)
  • chmod : octal mode (essentials)

Octal uses three digits for u , g , and o . Each digit is 4 (r) + 2 (w) + 1 (x) .

  • Value Bits Meaning
  • 7 rwx read + write + execute
  • 6 rw- read + write
  • 5 r-x read + execute
  • 4 r-- read only
  • 0 --- none

Memorize these common modes:

  • Mode Bits (approx.) Typical use
  • 755 rwxr-xr-x Programs and many directories
  • 644 rw-r--r-- Ordinary data files others may read
  • 600 rw------- Private files (SSH keys, secrets) chmod 644 report.txt
  • chmod 600 secret.env
  • chmod 755 backup.sh
  • Worked chmod sequences (symbolic ↔ octal) touch notes.txt script.sh secret.key
  • chmod 644 notes.txt # rw-r--r--
  • chmod u+x script.sh # add owner execute
  • chmod 755 script.sh # same end state in one octal step
  • chmod go-rwx secret.key # strip group/other
  • chmod 600 secret.key # equivalent → rw-------
  • ls -l notes.txt script.sh secret.key
  • Goal Symbolic Octal
  • Readable doc chmod a+r (drop go write if needed) 644
  • Private credential chmod go-rwx 600
  • Runnable script chmod u+x then go=rx 755
  • Group-writable data chmod g+w 664

Directory example: chmod 755 ~/public_html lets other accounts traverse ( x ) into the tree; files inside often stay 644 . chmod 700 on that directory blocks cd for others even when file modes look open.

  • Changing ownership with chown sudo chown alice report.txt
  • sudo chown alice:developers project/
  • sudo chown :developers shared.txt
  • Form Effect
  • chown user file Set owner
  • chown user:group file Set owner and group
  • chown :group file Set group only (common syntax)

chown usually requires root (via sudo ). The file owner may run chmod . Wrong mode → chmod ; wrong owner/group → chown .

Worked scenario: sam creates data.csv at 644 . Root runs chown sam:analysts data.csv and chmod 664 data.csv so group members can write.

  • Worked chown path: sudo mkdir -p /srv/team/inbox
  • sudo chown sam:analysts /srv/team/inbox
  • sudo chmod 775 /srv/team/inbox
  • echo "hello" | sudo tee /srv/team/inbox/readme.txt >/dev/null
  • sudo chown sam:analysts /srv/team/inbox/readme.txt
  • sudo chmod 664 /srv/team/inbox/readme.txt
  • ls -l /srv/team/inbox/readme.txt

Expect owner sam , group analysts , mode -rw-rw-r-- . Analysts can edit; outsiders can only read. If ls -l still shows root:root , chown was skipped— chmod never renames the owner.

Putting it together

Use ls -la to see hidden files and mode bits.

Decide file vs directory— x means different things .

Prefer 600 for secrets, 644 for ordinary readable files, 755 for executables/directories others must traverse.

Fix ownership with chown when the wrong user/group owns the object.

Permissions are the heart of Topic 5. Sticky directories and symlinks in 5.4 build on this rwx foundation.