User Commands

Create User

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

Modify 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.

Delete User

userdel <name>

Set Password

passwd <user>

Password-aging Options

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>

Switch User

su - <user>

List Groups of User

groups [<username>]

E.g:

groups chris
chris : chris wheel docker 

Group Commands

Create Group

groupadd

Delete Group

groupdel <name>

Switch Group

sg <group>

Files

/etc/passwd

User Database

root:x:0:0:root:/root/bin/bash
chris:x:1000:1000:Christoph Mueller:/home/chris:/bin/bash

Syntax (Seperated by :)

/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 :)

/etc/group

Group Database

root:x:0:
chris:x:4000:0:
adm:x:4:chris

Syntax (Seperated by :)

/etc/login.defs

Default values