What you will learn in this TP
- Manage accounts and groups
- Apply permissions, SGID and ACLs
- Delegate with sudo
Introduction #
What you will learn in this section
- Manage accounts and groups
- Apply permissions, SGID and ACLs
- Delegate with sudo
Context. A development team is joining the server. Each member needs an account, a shared project folder and the ability to restart nginx without being root, and an auditor must be able to read without modifying.
Prerequisites: a disposable Ubuntu 24.04 virtual machine (Multipass, Vagrant or cloud) with a sudo account · Estimated time: 45 min
A working team with least-privilege rights.Hands-on #
Guided steps, with their solution.
1. Create groups and accounts
Why? A group carries shared rights; never grant rights user by user.
Create thedevsgroup, usersaliceandbob(members of devs), auditorcaroland the shell-less service accountapp.2. Create the team folder
Why? The SGID bit inherits the devs group: without it, each file would take its author's personal group.
Create/srv/projetowned by group devs, mode 2770. Create a file as alice and check that bob can modify it.3. Protect a sensitive file
Why? A secret must only be readable by the account that uses it.
Create/srv/app/app.envowned byappwith mode 600, and check alice cannot read it.4. Grant read access with ACLs
Why? ACLs add a right for one person without adding them to the group or opening to everyone.
Give carol read access to/srv/projetand future files (default ACL). Check she can read but not write.5. Delegate with sudo
Why? Developers must restart nginx and read its logs, not get a root shell.
Install nginx, then create/etc/sudoers.d/devsallowing the devs group to restart nginx and read its logs. Validate the syntax and check alice's rights.6. Account policy and audit
Why? Unused accounts or unknown SUID binaries are entry points.
Enforce 90-day password expiry for alice, lock bob, list UID 0 accounts and SUID binaries.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Utilisateurs, groupes, sudo et permissions sous Linux
Gérer les comptes Linux (useradd, usermod, passwd, chage), les groupes, sudo et visudo, les permi...
Package managers
The different package managers for Kubernetes and their advantages.