Befehl zum Erstellen eines Benutzers unter Linux
#to create a home directory while adding the user
sudo useradd -m username
#to remove a user
sudo userdel username
#to create a specific home directory for the user anywhere
sudo useradd -m -d /opt/username username
#to create a specific userID (UID)
sudo useradd -u 1500 username
#to verify UID
id -u username
#to create a user in a specific group
sudo useradd -g GROUP username
#to verify above command
id -gn username
#to create a user and assign multiple groups
sudo useradd -g primary_group -G group2,group3 username
#to check
id username
#to create a user with a comment
sudo useradd -c "Comment" username
#to verify
grep username /etc/passwd
#to crete a user with an expiry-date
sudo useradd -e YYYY-MM-DD username
#to verify account expiry date
sudo chage -l username
#to view useradd default options
useradd -D
#to change useradd default options
#e.g default login shell from /bin/sh to /bin/bash
sudo useradd -D -s /bin/bash
#to verify
sudo useradd -D | grep -i shell
Chris Nzoka-okoye