Managing users is one of the most essential tasks in Ubuntu system administration. Whether you’re setting up a shared server or organizing access for different team members, understanding how to create and remove user accounts helps maintain a secure and well‑structured environment. Ubuntu 24.04 provides both command‑line and graphical ways to manage users, allowing you to choose whichever method suits your workflow best.
This guide walks you through adding new users, assigning passwords, verifying accounts, and removing users safely.
Table of Contents
Understanding User Management in Ubuntu 24.04
Ubuntu systems typically work with two types of users:
- Administrative (sudo) users, who can run privileged commands.
- Standard users, who have limited permissions.
Creating separate user accounts ensures each person gets only the level of access they need. It also helps maintain system integrity by preventing unauthorized system‑wide changes.
How to Add a User in Ubuntu 24.04
Ubuntu allows you to add users either through the command line or through the system’s user settings. The command‑line method offers more control and is commonly used by server administrators.
1. Adding a User with useradd
The useradd tool is a low‑level command that lets you create users with specific parameters.
To create a new user with a home directory:
sudo useradd -m <username>
The -m option ensures Ubuntu creates a home directory for the user. If you don’t specify options, Ubuntu applies system defaults stored in /etc/default/useradd.
Next, assign a password:
sudo passwd <username>
Ubuntu will warn you if the password is weak, so be sure to choose a secure one.
You can confirm the user’s existence by listing all system users:
awk -F’:’ ‘{ print $1 }’ /etc/passwd
You can also set the password during creation:
sudo useradd -m <username> -p <password>
After creation, log in as the user and run:
whoami
to confirm that everything is set up correctly.
2. Adding a User Through System Settings
On desktop versions of Ubuntu 24.04, you can use the graphical user interface:
- Open Settings.
- Navigate to Users.
- Unlock the panel using your administrator password.
- Click Add User and fill in the details.
This method is helpful if you prefer a non‑command‑line workflow
3. Adding a User to a Group
User groups help define what a user can and cannot do. For example, adding a user to the sudo group grants them administrative privileges.
To add a user to a group:
sudo usermod -aG <group-name> <usernam>
For granting sudo access:
sudo usermod -aG sudo <username>
The -aG option ensures the user is added to the group without being removed from existing ones.
How to Delete a User in Ubuntu 24.04
When someone no longer needs access to the system, removing their user account keeps the environment clean and secure. Ubuntu offers both command‑line and system‑setting options for account deletion.
1. Deleting a User with deluser
To delete a user account:
sudo deluser <username>
This removes the account but keeps the user’s home directory. If you want to remove their home directory as well:
sudo deluser –remove-home <username>
2. Deleting a User Through System Settings
If you’re using Ubuntu Desktop:
- Open Settings.
- Go to Users.
- Unlock the panel.
- Select the user.
- Click Remove User.
This option is simple but suited for workstation environments.
Additional Notes
- Always verify user actions after creation or deletion to ensure the system reflects the changes properly.
- Keep user permissions organized, and grant administrative rights only when necessary.
- Use strong passwords to maintain system security.
Managing users in Ubuntu 24.04 is straightforward once you understand the available tools. Whether you’re using useradd and deluser for precise control or the GUI for convenience, Ubuntu makes it easy to add and remove accounts according to your needs. Keeping your user list organized helps maintain a secure, efficient system that’s easy to manage over time.
If you need more advanced configurations, such as modifying user permissions, managing SSH access, or automating account creation, Ubuntu provides flexible tools to support deeper customization.
Click here to learn how to create and manage folders in Ubuntu 24.04.