useradd [-m] [-s /bin/bash] [...] <user>
| Paramter | Definition | Remark |
|---|---|---|
| -m | Create Home Directory | Copy from /etc/skel |
| -s <shell> | Define Shell | e.g. /bin/bash |
| -c <Comment> | Define Coment | usually fullname |
| -u | Define UID | |
| -g <gid/name> | Define primary group by UID or name | |
| -U | Create group with the same name | |
| -G | Additional groups of the user |
usermod [-s /bin/bash] <user>
Accepts the most parameters from useradd.
Additional important parameters:
| Paramter | Definition | Remark |
|---|---|---|
| -a <Groups> | Append | Important when defining groups with -G.Without -a the user will be removed from not mentioned groups. |
userdel <name>
passwd <user>
Display password-aging for user:
chage -l <user>
Last password change : Nov 04, 2026
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
Paramters for chaning password-aging:
| Paramter | Definition | Remark |
|---|---|---|
| -m | Set the minimum days | |
| -M | Set the maximum days | |
| -M | Set the expire day | |
| -i | Use iso date (YYYY-MM-DD) format for dates | |
| -W | Set the warning days |
chage -M 99999 <user>
su - <user>
groups [<username>]
E.g:
groups chris
chris : chris wheel docker
groupadd
groupdel <name>
sg <group>
User Database
root:x:0:0:root:/root/bin/bash
chris:x:1000:1000:Christoph Mueller:/home/chris:/bin/bash
Syntax (Seperated by :)
x = moved to /etc/shadow )Password Database
root:!:18006:0:99999:7:::
sys:*:18006:0:99999:7:::
chris:$6$gN2..$We....:18006:0:99999:7:::
Syntax (Seperated by :)
$) or * (No password) or ! (User locked)
Group Database
root:x:0:
chris:x:4000:0:
adm:x:4:chris
Syntax (Seperated by :)
x references to /etc/gshadow, but not commonly used anymore),)Default values