Your DevOps study space

Real explanations. Videos with tests. Fresh exams every time. Keep the streak alive and watch the XP stack up.

Permissions and users · Linux Docs · StackwisePlanDevOps Permissions and users · Linux Docs · StackwiseCodePython Permissions and users · Linux Docs · StackwiseBuildDocker Permissions and users · Linux Docs · StackwiseTestDevOps Permissions and users · Linux Docs · StackwiseReleaseGit Permissions and users · Linux Docs · StackwiseDeployKubernetes Permissions and users · Linux Docs · StackwiseOperateLinux Permissions and users · Linux Docs · StackwiseMonitorDevOps

Pick a topic

Eight tracks, each with docs, a cheat sheet, videos and tests.

How it works

One loop, repeated until it sticks.

Jump back in

Picked up from where you left off.

Free forever

Your DevOps journey starts with one click.

Sign in with Google or GitHub to open every chapter, video, test and challenge. Your progress is saved wherever you learn.

Permissions and users

Linux is built for many users sharing one machine, so every file records who owns it and what everyone else may do with it. Most "Permission denied" errors you will hit on a server come down to the rules in this chapter.

Owner, group, others

Every file has an owner (a user) and a group. When someone tries to open a file, Linux checks them in order: if you are the owner, the owner permissions apply; otherwise if you are in the file's group, the group permissions apply; otherwise the "others" permissions apply. Only one set is ever used.

Each set is a mix of three permissions:

  • r (read): see the contents. For a folder, list what is inside.
  • w (write): change the contents. For a folder, create, rename or delete files inside it.
  • x (execute): run the file as a program. For a folder, it means you may enter it (cd into it) at all.

Reading ls -l

$ ls -l deploy.sh
-rwxr-x--- 1 demee devs 812 Sep 27 10:14 deploy.sh

The first character is the type (- file, d directory, l link). Then come three groups of three: rwx for the owner (demee can do everything), r-x for the group (members of devs can read and run it), and --- for everyone else (no access at all).

$ ls -l deploy.sh -> -rwxr-x--- demee devs deploy.sh-typerwxowner: demeer-xgroup: devs---everyone elsechmod 750= rwxr-x---file4+2+1 = 74+0+1 = 50+0+0 = 0r = 4 w = 2 x = 1 - = 0 (add them up per group)
Read the ten characters as 1 + 3 + 3 + 3. Each group of three is a sum of r=4, w=2, x=1, which is where numbers like 750 come from.

Changing permissions with chmod

The numeric form is the one you will see in tutorials and exams. Each permission has a value: read = 4, write = 2, execute = 1. Add them up for each of owner, group and others, and you get three digits.

$ chmod 755 deploy.sh   # 7=rwx owner, 5=r-x group, 5=r-x others
$ chmod 644 notes.txt   # 6=rw- owner, 4=r-- group, 4=r-- others
$ chmod 600 ~/.ssh/id_ed25519   # private key: only you can read or write it
$ chmod +x script.sh    # just add execute, leave the rest alone
$ chmod -R g+w shared/  # give the group write access, recursively

755 is the usual setting for scripts and folders, 644 for ordinary files, and 600 for secrets. Play with the calculator to see how the digits and letters line up:

Try it: chmod calculator
Owner
Group
Others
644-rw-r--r--
$ chmod 644 file

Users, groups and ownership

Accounts are listed in /etc/passwd (name, user ID, home folder, login shell); the password hashes are kept separately in /etc/shadow, which only root can read. Groups let you give several people the same access without listing each one.

$ sudo adduser deploy              # new user with a home folder
$ sudo usermod -aG sudo deploy     # add to the sudo group (-a = append, don't replace)
$ sudo chown deploy:deploy /srv/app   # new owner:group
$ sudo chown -R www-data /var/www     # recursively
$ id deploy                        # which groups is deploy in?
$ passwd                           # change your own password
Forgetting -a in usermod -aG replaces all the user's groups instead of adding one, which can lock them out of sudo.

root, sudo and su

root is the superuser: permissions don't apply to it, so it can read, change or delete anything. Working as root all the time is dangerous because one typo can destroy the system, which is why servers are normally set up with a regular user that borrows root powers only when needed.

sudo command runs one command as root after asking for your own password, and it logs what you did. su username switches your whole shell to another user and needs their password. In practice you use sudo for everything, and on many cloud servers root login is disabled entirely.

Questions

Pick an answer. Get it wrong and you can try again right away, no waiting. 10 questions per topic - pick a filter below, then use Recreate questions for a fresh set on that topic.

Fresh questions every time

Exam

A mixed test across the whole site, shuffled so you never know which topic comes next. When you submit, every mistake comes with the reason and a jump to the exact moment in the video that explains it.

30 questions 6 topics 20 minute limit Up to 70 XP
1–4 answer · ←→ move
History

Essay

0 / 200-250 words
Sample answer
History
0:00 / 0:00
Not started

on YouTube
Subscribe

Topic progress

Activity

Achievements

Settings

Your profile and your account.

Profile details

* Required. Saved in this browser until you sign in.

Letters, numbers, dots, dashes and underscores.
0 / 160

Account

Checking…

App

Install Stackwise on your phone or computer. It opens in its own window from your home screen, and the Docs and cheat sheets you've opened keep working without internet.

Only admins can see this

Dashboard

Sign-ups, activity, messages and reviews in one place.

Prove it

Certificates

Pass a topic's test and get a certificate with its own public page you can share or add to LinkedIn. Each test is 10 questions drawn at random and graded on the server; you need 8 right, you have 15 minutes, and you get one try per topic a day.

From first command to production

Linux for DevOps

A path through Linux the way DevOps engineers use it: ten stages, every command explained with its flags, examples, real output and mistakes, the combinations engineers chain together, and incidents worked through step by step. Practise everything in a safe lab folder.

Before the interview

Interview prep

Questions that come up in real DevOps interviews, with the kind of answer that lands. Say yours out loud first, then compare. Each one links to the chapter that goes deeper.

    Private to you

    My notes

    Everything you wrote down while watching and reading, in one place. Saved to your account, never shown to anyone.