Making accounts and groups changes /etc/passwd and /etc/group. Only root can change them, so each command needs sudo.
| Command | Does |
|---|---|
sudo groupadd cashiers | Makes the group cashiers |
sudo useradd -m -s /bin/bash chen | Makes the account chen |
sudo usermod -aG cashiers chen | Adds chen to the group cashiers |
useradd: make an account
sudo useradd-mmake /home/chen-s /bin/bashthe login shellchenthe name
Ubuntu also makes the primary group chen.
usermod -aG: add to a group
text
learner@tidepool:~$ sudo usermod -aG cashiers chen
learner@tidepool:~$ groups chen
chen : chen cashiers| Flags | Does |
|---|---|
-aG cashiers | Adds cashiers to the groups of the account |
-G cashiers | Replaces all of the other groups with cashiers |