Linux User Management: useradd, usermod and passwd

Published 2026-08-05 · Learn Linux

Linux user management runs on three commands: useradd creates a user, passwd sets the password, and usermod changes groups and account settings afterwards. These need root privileges, so prefix them with sudo.

Create a user

useradd creates the account. Add -m to create the home directory and -s to set the login shell.

$ sudo useradd -m -s /bin/bash alice

Set the password

A new user has no password until you run passwd. It asks for the password twice and updates the stored hash in /etc/shadow.

$ sudo passwd alice

Add a user to a group

Groups control shared permissions. Add a user to the sudo group to grant admin rights, or to a project group for shared files. Use -aG (append to group) and never forget the -a — without it usermod replaces all group memberships.

$ sudo usermod -aG sudo alice
$ sudo usermod -aG developers alice

List and check users and groups

Check what groups a user belongs to with groups, and see all accounts in /etc/passwd.

$ groups alice
$ cat /etc/passwd | grep alice

Delete or lock a user

To temporarily block logins without deleting the account, lock the password with passwd -l. To remove the account and its home directory, use userdel -r.

$ sudo passwd -l alice
$ sudo userdel -r alice

Combine user management with chmod to control what each user and group can do. See useradd for the full option list.

Keep learning

Related guides: Linux chmod Command: A Complete Permissions Guide · How to Set Up SSH Keys for Passwordless Login · Linux Environment Variables: How to Set and Use Them. Read all tutorials on the Learn Linux blog.