Skip to content
Back to lessons
IntermediateLesson 4 of 5 · 1 min read

Users and Permissions

Understand users, groups, and the chmod / chown commands.

Linux is a multi-user system. Every file belongs to a user and a group, and has three permission sets: owner, group, and everyone else.

Reading permissions

Run ls -l and you will see something like:

-rwxr-x---  1  alice  devs  1024  Jun 28  script.sh

Breakdown:

  • - - regular file (d for directory)
  • rwx - owner can read, write, execute
  • r-x - group can read and execute
  • --- - others have no access

Changing permissions

chmod 755 script.sh      # owner: rwx, group+other: rx
chmod +x script.sh       # add execute for everyone
chmod 600 secret.txt     # owner only

The numbers are octal:

Digitrwx
7yesyesyes
6yesyes
5yesyes
4yes

Why this matters

Servers get hacked because files are too permissive. When in doubt, least privilege - grant only what is needed.

Your notes

Notes are kept on this browser only.

Challenge

Make `script.sh` executable for the owner only (no permissions for group or others).

Need a nudge?

Tip: type the command in the sandbox on the right, or paste the solution here. The sandbox runs in real time.

Quiz

Answer these to lock in the concepts. Score at least 80% to mark the lesson complete.

Mark as complete

Skipped the challenge? You can mark this lesson done by hand.