Users, accounts and what useradd does
Creating an account is one command; knowing what it did is the examinable part. This guide reads the seven fields of /etc/passwd, shows where a new home directory comes from, contrasts a login account with a service account, and demonstrates what userdel leaves behind - which is more than people expect.
Users and Groups Guide 18 of 38 Beginner
- PlatformsUbuntu 26.04 LTS + AlmaLinux 10.2
- LVM2.03.31 (Ubuntu) / 2.03.36 (AlmaLinux)
- nftables1.1.6 (Ubuntu) / 1.1.5 (AlmaLinux)
- TimeAbout 18 min
shadow-utils on both families. The defaults differ slightly - UID_MIN is 1000 on both modern families, and USERGROUPS_ENAB yes giving each user a private group is the norm on both.
- Firewallufw 0.36.2 enabled but reporting inactive / firewalld active
- Network confignetplan + systemd-networkd / NetworkManager 1.56.0
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LFCS-A01 | 192.168.0.70 | Ubuntu 26.04 LTS | Primary host - most guides run only here | 2 Core | 4 GB | 50 GB |
| LFCS-C01 | 192.168.0.72 | AlmaLinux 10.2 | The other distribution - dnf, firewalld and NetworkManager | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because creating an account is one command and knowing what it did is the examinable part. This matters because nologin does not block sudo -u - the account you thought was unusable is still reachable.
- seeing the four things useradd actually creates
- reading the seven fields, and the file you cannot read
- building a service account, then finding that nologin does not block
sudo -u - changing an account, including the flag that moves a home directory
- seeing what removing one leaves behind, and running all of it again on the other family
Before you start
- guide 4 - id, getent and the group that grants sudo.
-
What useradd actually does
-
The seven fields, and the file you cannot read
-
A service account is a different shape
-
And nologin does not block sudo -u
-
Changing an account
-
And what removing one leaves behind
-
The same commands on Ubuntu, and where they differ