Skip to content
ohsudo, Home

Module 3: Permissions

What rwx means, and chmod

Every file says who can read it, write to it and run it. Permission denied is one of the first errors everyone meets, and once you can read those letters, it stops being a mystery.

● Runs 100% in your browser. Nothing here can harm a real system.

Step 1 of 6

Read the permissions

In ls -l, the first column shows the permissions: -rw-r--r-- means a file (-), then rw- for its owner, r-- for its group, and r-- for everyone else. r is read, w is write, and x is execute.

Your task

Look at the permissions of deploy.sh.

guest@ohsudo: ~ — Ubuntu 24.04

Starting the terminal…

What you'll practice

  1. Read the permissions. In ls -l, the first column shows the permissions: -rw-r--r-- means a file (-), then rw- for its owner, r-- for its group, and r-- for everyone else. r is read, w is write, and x is execute.
  2. Try to run it. ./ means "in this folder". Nobody has x on this file, so the system refuses, even for its owner.
  3. Make it executable. chmod changes permissions. +x adds execute, and leaves the rest alone.
  4. Run it now. Check it by running it. If a script still fails with a strange error, the usual causes are in the article linked below.
  5. Numbers. Each group is also a digit: r is 4, w is 2 and x is 1, added up. So 6 is rw-, 4 is r-- and 0 is nothing. 600 means only the owner can read and write, which is what a file with passwords needs.
  6. Folders. On a folder, x means you can enter it, and without that nothing inside can be reached. 755 lets everyone in and lets only you change things, which is the usual setting for shared folders.

See also