Options:
- -d home directory
- -s starting program (shell)
- -p password
- -g (primary group assigned to the users)
- -G (Other groups the user belongs to)
- -m (Create the user’s home directory
Example: To add a new user with:
- a primary group of users
- a second group mgmt
- starting shell /bin/bash
- password of xxxx
- home directory of roger
- create home directory
- a login name of roger
You would:
sudo useradd -g users -G mgmt -s /bin/bash -p xxxx -d /home/roger -m roger
To add to sudo users:
sudo usermod -a -G admin username