User management is a key part of Linux system administration. Whether you’re running a server or just managing your personal machine, understanding how to create, modify, and delete user accounts and groups is essential for keeping your system secure and organized.
- 🧠 Why User and Group Management Matters
- 👤 Linux User Types
- 📋 Basic Concepts: Users and Groups
- 💻 Method 1: Manage Users via Terminal
- ✅ 1. Add a New User
- ✅ 2. Set or Change User Password
- ✅ 3. Add User to a Group
- ✅ 4. Create a New Group
- ✅ 5. Change a User’s Default Group
- ✅ 6. View a User’s Group Memberships
- ✅ 7. Delete a User
- ✅ 8. Delete a Group
- 🗂️ Method 2: Manage Users and Groups Using GUI
- 📂 File Locations for Users & Groups
- 🔐 Example: Create a Developer Group and Add Users
- 🧪 Practice Exercise for Beginners
- 🧾 Quick Command Reference
- ✅ Conclusion
In this guide, we’ll cover how to do it using both the command line (Terminal) and graphical interface (GUI) — step by step.
🧠 Why User and Group Management Matters
Linux is a multi-user operating system, meaning:
- Multiple people (or services) can use the system at the same time.
- Each user has their own home directory, permissions, and settings.
- Groups help organize users and set access rights for folders, applications, and system services.
👤 Linux User Types
| User Type | Description |
|---|---|
| Root | The superuser with full system access (like “Administrator” in Windows) |
| Regular | Standard users with limited permissions |
| System/User Services | Background services like www-data, mysql, etc. |
📋 Basic Concepts: Users and Groups
- Every user belongs to at least one group.
- You can assign users to multiple groups.
- Groups are used to control access to files, folders, and commands.
💻 Method 1: Manage Users via Terminal
Let’s go through the most common user management tasks using the terminal.
✅ 1. Add a New User
sudo adduser username
You’ll be prompted to set a password and add user details (you can press Enter to skip optional fields).
Example:
sudo adduser john
✅ 2. Set or Change User Password
sudo passwd username
Example:
sudo passwd john
✅ 3. Add User to a Group
sudo usermod -aG groupname username
Example:
sudo usermod -aG sudo john
This gives john access to run commands with sudo.
✅ 4. Create a New Group
sudo groupadd groupname
Example:
sudo groupadd developers
✅ 5. Change a User’s Default Group
sudo usermod -g newgroup username
✅ 6. View a User’s Group Memberships
groups username
✅ 7. Delete a User
sudo deluser username
To also delete their home directory:
sudo deluser --remove-home username
✅ 8. Delete a Group
sudo groupdel groupname
🗂️ Method 2: Manage Users and Groups Using GUI
If you’re using a Linux desktop, you can manage users without the terminal.
🔹 On Ubuntu or Linux Mint:
- Open Settings > Users
- Click Unlock (top right) and enter your password
- Click “Add User”
- Choose account type: Standard or Administrator
- Set password and other details
You can also manage group memberships using tools like:
- Users and Groups (Linux Mint)
- GNOME Users Admin (
gnome-system-tools, may need to install it)
sudo apt install gnome-system-tools
📂 File Locations for Users & Groups
| File | Purpose |
|---|---|
/etc/passwd | Contains basic user account info |
/etc/shadow | Contains encrypted user passwords |
/etc/group | Lists groups and their members |
You can view them using cat or less:
less /etc/passwd
🔐 Example: Create a Developer Group and Add Users
sudo groupadd developers
sudo adduser alice
sudo usermod -aG developers alice
Now alice is part of the developers group.
To verify:
groups alice
🧪 Practice Exercise for Beginners
- Create a new user
testuser
sudo adduser testuser
- Add
testuserto thesudogroup
sudo usermod -aG sudo testuser
- Remove the user and their home directory
sudo deluser --remove-home testuser
🧾 Quick Command Reference
| Task | Command Example |
|---|---|
| Add new user | sudo adduser username |
| Set/change password | sudo passwd username |
| Add user to group | sudo usermod -aG groupname username |
| Create group | sudo groupadd groupname |
| Delete user | sudo deluser username |
| Delete user + home dir | sudo deluser --remove-home username |
| Check group memberships | groups username |
| Delete group | sudo groupdel groupname |
✅ Conclusion
Managing users and groups in Linux is simple but powerful. With just a few commands, you can control who has access to what — a crucial part of maintaining system security and organization.
Start by creating a few test users and groups to practice. Over time, managing users will become second nature.









