Check users by looking at /etc/passwd
Basic usage:
# useradd -m (user)
Important options:
login name -> by default
group -> -G //separate multiple by commas: group1,group2
with home dir -> -m
shell -> -s
full name -> -c
Example more complicated usage:
# useradd -m -c "Bruno Huber" -s /bin/bash -G sudo,systemd-journal bruhub
The command userdel
can be used to remove users from a system.
Using it with the -r
additionally deletes the user home directory and mail spool.
# userdel -r (user)
Add user to more groups:
# usermod -a -G (group1),(group2) (user)
Alternative command:
# gpasswd -a (user) (group)
# gpasswd -d (user) (group)
Check a user's groups with id (user)
# groupadd (group)
# groupmod -n (new_group) (old_group)
# groupdel (group)