Section 1 of 11

1 Before you start

Before you begin, take a few minutes to check what you already know and how confident you feel. You will see the same questions again at the end of the module — this helps both you and us measure what you have learned. Click an option for every question and confidence rating, then click Next to continue.

Pre-test

In the permission string -rw-r--r--, what can members of the group do?

Pre-test

Which command makes a script file executable for the owner?

Pre-test

What does chmod 644 set permissions to?

Pre-test

On a shared cluster where you do NOT have sudo, what can you NOT do?

Pre-test

What does the leading 'd' in drwxr-xr-x tell you?

Pre-test

In chmod numeric mode, which single digit means read + write + execute?

Pre-test

What does chmod go-w cohort.csv do?

Pre-test

A script shows -rw-r--r-- and running ./script.sh gives 'Permission denied'. Why?

Pre-confidence

I can read the rwx permission string from ls -l output.

Not at all confident
Fully confident
Pre-confidence

I can change a file's permissions using either symbolic or numeric chmod.

Not at all confident
Fully confident
Pre-confidence

I know why chown usually needs sudo and what to do when I cannot use it.

Not at all confident
Fully confident
Section 2 of 11

2 Introduction

Linux is built for many people sharing one machine. Every file carries a small record of who is allowed to do what. Most of the time you do not think about permissions - until something you expected to read or run suddenly refuses, and you need to know how to look.

  • Reading the permission string in ls -l output.
  • The three actions: read (r), write (w), execute (x).
  • The three audiences: owner (u), group (g), others (o).
  • Changing permissions: chmod with symbolic and numeric modes.
  • Changing ownership: chown - and why it usually needs sudo.
A Linux permission string is not line noise but a position-based grid, where the first character is the file type and the next nine pack three audiences (owner, group, others) each against the same three actions (read, write, execute).
A Linux permission string is not line noise but a position-based grid, where the first character is the file type and the next nine pack three audiences (owner, group, others) each against the same three actions (read, write, execute).
Section 3 of 11

3 Reading the Permission String

When you are writing bash scripts, you will eventually run into a frustrating "Permission denied" error. To understand why, you need to read the first column of the ls -l command.

Try it out

Try this snippet in the Bash Scratchpad on the right.

Try this snippet
$ ls -l

It looks like a cryptic secret code, but it actually reads left to right in four simple chunks. Let's take the output -rw-r--r-- and split it up: - then rw- then r-- then r--.

  • First character: The file type. A - means it is a regular file, a d means it is a directory (folder), and an l means it is a symlink (shortcut).
  • Next three: What the OWNER can do.
  • Next three: What the assigned GROUP can do.
  • Last three: What EVERYONE ELSE on the system can do.
  • So -rw-r--r-- means: regular file; owner can read and write; group can read; others can read. No one can execute it - it is not a program.
The ten-character permission string is one file-type flag followed by three fixed read-write-execute triplets for owner, group, and others, where a letter grants that permission and a dash means it is switched off.
The ten-character permission string is one file-type flag followed by three fixed read-write-execute triplets for owner, group, and others, where a letter grants that permission and a dash means it is switched off.
Section 4 of 11

4 The Three Actions

Those letters behave slightly differently depending on whether you are looking at a file or a folder. Here is the breakdown:

  • r (read) - on a file: read its contents. On a folder: list it with ls.
  • w (write) - on a file: change its contents. On a folder: add, remove, or rename entries.
  • x (execute) - on a file: run it as a program. On a folder: step into it with cd.

So, what happens if a folder has x but no r? This is entirely possible!

It is like walking into a pitch-black room. You can go inside (using cd), but you can't look around to see what is there (using ls). If you already know the exact name of a file hidden in the dark, you can still reach out and grab it—but casual snooping is impossible!

A folder's execute bit lets you step inside and open a file whose exact name you already know, while only the read bit lets you list or discover what is inside, so a folder with x but no r is one you can enter and reach into but never browse.
A folder's execute bit lets you step inside and open a file whose exact name you already know, while only the read bit lets you list or discover what is inside, so a folder with x but no r is one you can enter and reach into but never browse.
Section 5 of 11

5 Changing Permissions - chmod

chmod changes the permission string. Two ways to write the change:

  • symbolic: uses letters and math symbols (like +x to add execute, or -w to remove write) to adjust specific permissions, making it perfect for quick, targeted tweaks.
  • numeric: uses a three-digit number (like 755 or 644) to instantly set all the permissions at once, which is the fastest method once you understand the simple math behind it.
Section 5.1 of 11

5.1 Symbolic mode - easier to read

Now that you can read the permission string, how do you actually change it? This is where the chmod (change mode) command comes in.

  • Pick your audience: u (owner), g (group), o (others), a (all).
  • Direction: + (add), - (remove), = (set exactly).
  • Action: r (read), w (write), x (execute).
$ chmod u+x analyse_cohort.sh # owner can now execute
$ chmod go-w cohort_2026.csv # group and others lose write
$ chmod a+r report.txt # everyone can read
A symbolic chmod is read as three independent choices, who to affect (u, g, o, a), whether to add or remove (plus or minus), and which permission (r, w, x), so the command touches only the named switches and leaves every other permission exactly as it was.
A symbolic chmod is read as three independent choices, who to affect (u, g, o, a), whether to add or remove (plus or minus), and which permission (r, w, x), so the command touches only the named switches and leaves every other permission exactly as it was.
Section 5.2 of 11

5.2 Numeric (octal) mode - three digits

Each chunk of rwx collapses to a digit by adding: r (read)=4, w (write)=2, x (execute)=1.

To figure out a permission number, you just add up the points for the actions you want to allow.

  • Want to allow read (4) and write (2)? 4+2 = 6
  • What to allow everything (read, write, execute)? 4+2+1 = 7
  • Want to allow only read (4)? Just 4

Whenever you use chmod, you always provide three digits in a row. These three digits map directly to the three user groups we learned about: [Owner] [Group] [Everyone Else].

For example, Let’s break down chmod 755:

  • First digit (7) is for the OWNER: 4+2+1 (Read, Write, Execute)
  • Second digit (5) is for the GROUP: 4+1 (Read, Execute)
  • Third digit (5) is for EVERYONE ELSE: 4+1 (Read, Execute)
$ chmod 755 analyse_cohort.sh
$ ls -l analyse_cohort.sh
-rwxr-xr-x 1 student staff 1204 May 24 11:30 analyse_cohort.sh
A group's permission digit is just the sum of read (4), write (2) and execute (1) for the switches you turn on, which is why rwxr-xr-x adds up to 755.
A group's permission digit is just the sum of read (4), write (2) and execute (1) for the switches you turn on, which is why rwxr-xr-x adds up to 755.

644 for data files and 755 for scripts and folders covers about 90% of cases. For the rest, fall back to symbolic mode.

Try it out

Try this snippet in the Bash Scratchpad on the right.

Try this snippet
$ ls -l scripts/qc.sh
$ chmod +x scripts/qc.sh
$ ls -l scripts/qc.sh
$ chmod 644 scripts/qc.sh
$ ls -l scripts/qc.sh
Section 6 of 11

6 Changing Ownership - chown

chown changes who owns a file. Because handing a file to another user is security-relevant, you can only chown a file you do not already own if you are root - in practice, with sudo.

$ sudo chown alice cohort_2026.csv
$ sudo chown alice:researchers cohort_2026.csv # owner alice, group researchers

On a shared machine where you do NOT have sudo (the norm on any research cluster), you cannot chown at all. What you can do is chmod files you own, and use group membership to share access.

Section 7 of 11

7 Common Pitfalls

Even with a solid grasp of the point system, you are still going to hit a few roadblocks as you start working in the terminal. Here is a quick troubleshooting guide for the most common permission traps you will encounter:

  • "Permission denied" when running a script usually means the execute bit is off. chmod +x analyse.sh and try again.
  • "Operation not permitted" on chown - you are not root. Either ask the admin or make a copy you do own.
  • chmod 777 everything - the "turn off all the safety" setting. Tempting when things do not work, almost never the right fix. If it works at 777 but not at 755, the real problem is somewhere else.
Section 8 of 11

8 Check your understanding

You have reached the end of the module. Try the same questions again — your answers here, paired with your pre-test answers, are how we measure what the module taught you. Answer every question and confidence rating, then click Submit and see results to view your score.

Post-test

In the permission string -rw-r--r--, what can members of the group do?

Post-test

Which command makes a script file executable for the owner?

Post-test

What does chmod 644 set permissions to?

Post-test

On a shared cluster where you do NOT have sudo, what can you NOT do?

Post-test

What does the leading 'd' in drwxr-xr-x tell you?

Post-test

In chmod numeric mode, which single digit means read + write + execute?

Post-test

What does chmod go-w cohort.csv do?

Post-test

A script shows -rw-r--r-- and running ./script.sh gives 'Permission denied'. Why?

Post-confidence

I can read the rwx permission string from ls -l output.

Not at all confident
Fully confident
Post-confidence

I can change a file's permissions using either symbolic or numeric chmod.

Not at all confident
Fully confident
Post-confidence

I know why chown usually needs sudo and what to do when I cannot use it.

Not at all confident
Fully confident
Section 9 of 11

9 Your results

Here is how your post-test answers compare with your pre-test answers. The pre/post pairing is the most reliable way to see what this module actually taught you.

Your score

Submit the post-test to see your results.

Muddiest point

What is the one thing from this module that is still unclear to you?

Rate this module

Overall, how would you rate this module?

How likely are you to recommend this module to a peer? (0 = not at all, 10 = extremely likely)