Signal9Signal9 — home
online
back to labs

First User: Accounts, Groups and Locks

EasyLinux Fundamentals15-20 min
The brief

Every person and every service on a Linux box runs as a user, and groups decide who shares access to what. You're logged in as 'student' with sudo for the account tools only (useradd, adduser, usermod, userdel, groupadd, gpasswd and passwd). Looking at accounts needs no sudo at all.

Three requests from the admin, each with a common trap:

1. Create an account for dana with a home directory at /home/dana and bash as her login shell. A bare useradd dana gives her neither.

2. Add sam to the analysts group so he's in both teams. He must stay in developers. usermod -G on its own replaces all of a user's extra groups, and -a is what makes it add instead.

3. Lock the contractor account oldtemp so its password no longer works. Don't delete it, because its files are being kept for an audit.

id <user> shows a user's groups, getent passwd <user> shows their home directory and shell, and passwd -S <user> shows whether a password is locked (L) or usable (P). The same notes are in ~/brief.txt.

What you'll do
  • Create a user with a home directory and a login shell using useradd
  • Add a user to an extra group without dropping the ones they already have
  • Lock an account instead of deleting it, and check its state with passwd -S

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.