DevOps and cloud

Stage 1 · Lesson 2 of 10

Users, groups and sudo

Linux, the shell and scripting

On , every running program runs as some user, and that user decides what it can touch. The user can do anything. That is exactly why you should rarely log in as root.

Instead, give each person their own account with useradd. Put people into groups with usermod -aG, so a whole group can share access to a folder. Let trusted users run single commands as root with sudo.

Each sudo command is also recorded in the logs, so you can see who did what. Services should get their own user with few rights, such as www-data or a dedicated app user. Then a hacked web app cannot read other users' files or rewrite the system.

This idea, giving only the access a job needs, comes back later as in IAM and as containers that do not run as root.

Common trapadding every user to the sudo group because it is easier than working out the right group permissions.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Keep handy

  • The handful of flags people actually use for each command, one line each

Also worth your time

Mark this stage as not done?