Linux Fundamentals

Users, Groups & sudo

Provision users, organize them into groups, and grant least-privilege access.

30 min read beginner 3 objectives

Status

Not started

What you will learn

  • Create and manage users
  • Understand the sudoers model
  • Apply least privilege

New to this? Start here

The basics, in plain English

A Linux machine can be shared by many people and programs. Each one logs in as a "user" with its own name and its own limits. This keeps things organized and safe, so one account cannot accidentally wreck everything.

User
An account on the machine, with a name and its own files and permissions.
Root
The all-powerful admin account that can do absolutely anything. Powerful and dangerous.
Group
A label that bundles several users together so they can share access.
sudo
A command that lets a normal user run one command as the admin, after proving they are allowed.
Least privilege
The safety rule of giving each account only the access it truly needs and nothing more.
01

Identity

Users live in /etc/passwd, groups in /etc/group. useradd and usermod manage them. The principle of least privilege says: grant only what is needed.

02

sudo

sudo runs commands as another user, typically root. /etc/sudoers (edited with visudo) controls who can do what.

Try it yourself

bash
$useradd -m -s /bin/bash deploy
Create a “deploy” user with a home directory and the bash shell.
$usermod -aG docker deploy
Add that user to the docker group so it can run containers.
$visudo
Safely edit the sudoers file to grant admin rights.
$id deploy
Show the user’s ID and group memberships to confirm.
↳ lines explain what each command does — only the commands get copied

Finished this topic?

Mark it done to earn 100 XP and keep your streak alive.