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.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

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

🏷️ learner2🏷️ developers

Their open terminal (snapshot from login)

learner2developers
learner2 is logged in. Their badges: learner2 (their own), developers.

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 -l shows what the current user is allowed to run.
  • A user has one primary group and can have several supplementary groups, such as labgroup for a shared folder.

Commands

CommandDoes
sudo adduser learner2Creates a user with a home folder (Ubuntu's friendly wrapper)
sudo groupadd labgroupCreates a group
sudo usermod -aG labgroup learner2Appends the user to a supplementary Group. Forgetting -a replaces all their groups!
id learner2Shows user ID, primary group and all groups
whoami, groupsYour 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.

Practice challenge 01: users and groups

1. Create the group labgroup.

admin@ubuntu-lab:~$

Check your understanding0 of 3 correct

Question 1

1.What does sudo -l show?

Question 2

2.You run sudo usermod -G labgroup learner2 (without -a). What happens?

Question 3

3.You added yourself to a group but still get 'Permission denied' in your open terminal. Why?

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

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.