How to Create and Manage Users in Linux (User Accounts and Groups Explained)

Published On: October 3, 2025
Follow Us
How to Create and Manage Users in Linux

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.

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 TypeDescription
RootThe superuser with full system access (like “Administrator” in Windows)
RegularStandard users with limited permissions
System/User ServicesBackground 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:

  1. Open Settings > Users
  2. Click Unlock (top right) and enter your password
  3. Click “Add User”
  4. Choose account type: Standard or Administrator
  5. 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

FilePurpose
/etc/passwdContains basic user account info
/etc/shadowContains encrypted user passwords
/etc/groupLists 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

  1. Create a new user testuser
sudo adduser testuser
  1. Add testuser to the sudo group
sudo usermod -aG sudo testuser
  1. Remove the user and their home directory
sudo deluser --remove-home testuser

🧾 Quick Command Reference

TaskCommand Example
Add new usersudo adduser username
Set/change passwordsudo passwd username
Add user to groupsudo usermod -aG groupname username
Create groupsudo groupadd groupname
Delete usersudo deluser username
Delete user + home dirsudo deluser --remove-home username
Check group membershipsgroups username
Delete groupsudo 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.

sapan singh

👨‍💻 About Sapan Singh Hi, I’m Sapan Singh — a passionate software developer with a strong love for technology, gaming, and building useful digital tools.

Join WhatsApp

Join Now

Join Telegram

Join Now

Leave a Comment