Adding Users
Useradd and passwd.
A new teammate, Jo, needs an account on the team's Linux server. Creating users is an admin job, so it needs sudo. Let's set Jo up.

- A new teammate, Jo
- Needs an account
- An admin job
Creating the account
Sudo user add, dash M, dash S, slash bin slash bash, jo. Dash M creates Jo's home folder, and dash S sets the shell to bash. Then ID jo shows the new user and their groups, and LS shows Jo's home folder.
sudo useradd -m -s /bin/bash jo id jo uid=1002(jo) gid=1002(jo) groups=1002(jo) ls /home alex jo sam
Setting a password
The new account has no password yet. Sudo passwd jo sets one. It asks twice, to catch typos. Notice that nothing appears while you type a password. No stars, no dots. That's normal on Linux, and it hides even the length of the password.
sudo passwd jo New password: Retype new password: passwd: password updated successfully
Other user commands
A few more commands for managing users. User mod changes an existing user, for example adding them to a group. User del removes a user, and dash R removes their home folder too. And passwd on its own lets you change your own password.
| key | value |
|---|---|
| useradd -m -s | create a user |
| passwd user | set their password |
| usermod -aG | add to a group |
| userdel -r | remove a user |
Summary
Sudo user add creates an account, and sudo passwd sets its password. Typed passwords stay invisible. Next, groups for teamwork.
Key takeaways- sudo useradd -m -s /bin/bash jo
- sudo passwd jo
- userdel -r