How to Check your Ubuntu Version Using the Command Line
This guide will walk you through the steps to check your Ubuntu version using the…
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.
Ubuntu systems typically work with two types of users:
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.
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.
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.
On desktop versions of Ubuntu 24.04, you can use the graphical user interface:
This method is helpful if you prefer a non‑command‑line workflow
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.
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.
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>
If you’re using Ubuntu Desktop:
This option is simple but suited for workstation environments.
Additional Notes
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.
Explore more hosting insights, tips and industry updates.
This guide will walk you through the steps to check your Ubuntu version using the…
In this tutorial, we will show you how to blacklist an IP address in WHM…
Securing your website with SSL protects data and builds user trust. In this guide, we’ll…