Skip to content

Linux User Management

This guide explains how to manage users and groups in Linux, including creating users, assigning passwords, and organizing group memberships.


To create a simple user in Linux, you simlpy run the command:

Terminal window
useradd username

Here username is the name of the user. This creates a new user with default settings. You can use -m to create a home directory like shown below.

Terminal window
useradd -m username

This will create a home folder inside the /home directory like /home/username.

To change the password for a user, you can use:

Terminal window
passwd username

This will prompt you to set or change the password for the user.


To create a group, you simply use:

Terminal window
groupadd groupname

Here groupname will be the name of the group.

To add a user to a group, you can use:

Terminal window
usermod -aG groupname username

This will add the user username to the group groupname. To remember easily, usermod modiefies the user parameter and appends it to a Group. Without append, it might overwrite something you don’t want it to.

By running groups username, you will list all the groups that the user username is a member of. This way, you can check your configuration.


To delete users and groups, you can use userdel username to delete the user username and groupdel groupname to delete the group groupname.

If you also want te remove the users home directory, you can add -r to userdel like below.

Terminal window
userdel -r username

To list all users, you can use view /etc/passwd and to list all groups, you can use view /etc/group.