Module 1 · Linux Essentials for Security · Lesson 3 of 10
Users, groups and sudo
Create a test user and a shared group, confirm membership with id, and see why a fresh login matters.
In this lesson · about 20 minutes
- Create users and groups and add a user to a group
- Check identity and group membership with id, groups and whoami
- Explain what sudo -l shows and why least privilege matters
Whiteboard · watch and try
Whiteboard: adding a badge without losing the others
Press Play. The tutor shows the most common mistake with groups.
Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.
Try it · watch it happen
Users wear group badges
Press the buttons in different orders. Try the wrong command, then check the open terminal before and after logging in again.
On the system (the official list)
learner2
Their open terminal (snapshot from login)
Linux decides who can do what by user and group. Every file has one owner and one group. Every process runs as some user.
- root (user ID 0) can do anything. Avoid working as root.
- Regular users get sudo rights for specific admin tasks.
sudo -lshows what the current user is allowed to run. - A user has one primary group and can have several supplementary groups, such as
labgroupfor a shared folder.
Commands
| Command | Does |
|---|---|
sudo adduser learner2 | Creates a user with a home folder (Ubuntu's friendly wrapper) |
sudo groupadd labgroup | Creates a group |
sudo usermod -aG labgroup learner2 | Appends the user to a supplementary Group. Forgetting -a replaces all their groups! |
id learner2 | Shows user ID, primary group and all groups |
whoami, groups | Your own name and groups in this session |
Hands-on lab (simulated terminal)
Practice challenge 01: users and groups
You're the administrator admin on the lab VM. The sudo password in this lab is lab.
Step 1 of 5. Type each command and press Enter. Nothing runs on your computer.
1. Create the group labgroup.
Check your understanding0 of 3 correct
Quiz score: 0 of 3
Noviq Academy is free and for learning. Every terminal here is simulated and every log is synthetic. Practise on a disposable VM with a snapshot, never on a production server. Ubuntu is a trademark of Canonical Ltd.; this course is independent of Canonical.