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
- Read the permissions. In
ls -l, the first column shows the permissions:-rw-r--r--means a file (-), thenrw-for its owner,r--for its group, andr--for everyone else.ris read,wis write, andxis execute. - Try to run it.
./means "in this folder". Nobody hasxon this file, so the system refuses, even for its owner. - Make it executable.
chmodchanges permissions.+xadds execute, and leaves the rest alone. - 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.
- Numbers. Each group is also a digit:
ris 4,wis 2 andxis 1, added up. So6isrw-,4isr--and0is nothing.600means only the owner can read and write, which is what a file with passwords needs. - Folders. On a folder,
xmeans you can enter it, and without that nothing inside can be reached.755lets everyone in and lets only you change things, which is the usual setting for shared folders.