User Management in Linux: A Beginner's Guide to Creating, Modifying, and Deleting Users

Table of Contents What is a User in Linux? Types of Users UID: Unique User ID Explained Where User Data is Stored Essential User Management Commands Create a New User Set or Change a Password Check User Properties Switch Between Users Delete a User Add a Group Tips Managing users is a core skill for anyone working with Linux — whether you're running a local server or managing cloud infrastructure. In this guide, I break down the basics of Linux user accounts, from types and UIDs to creating, modifying, and deleting users. What is a User in Linux? A user is a login account on a Linux system that allows a person (or system process) to access the computer's resources. Each user has permissions that control what they can or can't do. Types of Users System User Created automatically during OS installation Typically used for running services and system processes Examples: root, apache, daemon Normal User Created manually by an administrator Used for human users to log in and run applications Example: john, developer1 UID: Unique User ID Explained Every user in Linux is assigned a UID (User Identifier) UID Range Description 0 Reserved for the root (superuser) 1–999 Reserved for system/service users 1000–60000 Normal user accounts Where User Data is Stored File Purpose /etc/passwd Stores user account info /etc/shadow Stores user password and aging info Essential User Management Commands Create a New User useradd james - Creates a new user account Set or Change a Password passwd james - Assigns or updates the password for a user. You will be prompted to enter the password twice. Check User Properties grep james /etc/passwd - Displays account details. Check Password Properties grep james /etc/shadow - View password aging and security info for a user. Switch Between Users su james - Switches from the current user Modify an Existing User usermod -l newname oldname - Changes a username from oldname to newname. usermod -l james daniel Delete a User userdel james - Delete user only userdel -r james - Delete user and their home directory Add a Group groupadd itdepartment - Create a group Add User to a Group usermod -aG groupname username - Adds a user to a supplementary group. usermod -aG itdepartment james List All Groups a User Belong to groups username groups james Tips Use man or info on the command - These give detailed documentation right in the terminal. It’s like built-in help. Managing users is an important part of working with Linux. Whether you’re adding new people to the system, setting up accounts for services, or removing old users, these commands make it easy to do the job with confidence.

Apr 18, 2025 - 20:02
 0
User Management in Linux: A Beginner's Guide to Creating, Modifying, and Deleting Users

Table of Contents

  • What is a User in Linux?
  • Types of Users
  • UID: Unique User ID Explained
  • Where User Data is Stored
  • Essential User Management Commands
    • Create a New User
    • Set or Change a Password
    • Check User Properties
    • Switch Between Users
    • Delete a User
    • Add a Group
    • Tips

Managing users is a core skill for anyone working with Linux — whether you're running a local server or managing cloud infrastructure. In this guide, I break down the basics of Linux user accounts, from types and UIDs to creating, modifying, and deleting users.

What is a User in Linux?

A user is a login account on a Linux system that allows a person (or system process) to access the computer's resources. Each user has permissions that control what they can or can't do.

Types of Users

System User

  • Created automatically during OS installation
  • Typically used for running services and system processes
  • Examples: root, apache, daemon

Normal User

  • Created manually by an administrator
  • Used for human users to log in and run applications
  • Example: john, developer1

UID: Unique User ID Explained

Every user in Linux is assigned a UID (User Identifier)

UID Range Description
0 Reserved for the root (superuser)
1–999 Reserved for system/service users
1000–60000 Normal user accounts

Where User Data is Stored

File Purpose
/etc/passwd Stores user account info
/etc/shadow Stores user password and aging info

Essential User Management Commands

Create a New User

useradd james - Creates a new user account

Image description

Set or Change a Password

passwd james - Assigns or updates the password for a user.
You will be prompted to enter the password twice.
Image description

Check User Properties

grep james /etc/passwd - Displays account details.
Image description

Check Password Properties

grep james /etc/shadow - View password aging and security info for a user.
Image description

Switch Between Users

su james - Switches from the current user
Image description

Modify an Existing User

usermod -l newname oldname - Changes a username from oldname to newname.
usermod -l james daniel

Delete a User

userdel james - Delete user only
Image descriptionuserdel -r james - Delete user and their home directory

Add a Group

groupadd itdepartment - Create a group
Image description

Add User to a Group

usermod -aG groupname username - Adds a user to a supplementary group.
usermod -aG itdepartment james

Image description

List All Groups a User Belong to
groups username
groups james
Image description

Tips

Use man or info on the command - These give detailed documentation right in the terminal. It’s like built-in help.
Image description

Managing users is an important part of working with Linux. Whether you’re adding new people to the system, setting up accounts for services, or removing old users, these commands make it easy to do the job with confidence.