DEV Community

Cover image for User Management in Linux
Chielo Chiamaka
Chielo Chiamaka

Posted on • Edited on

User Management in Linux

Table of Contents

What is a User in Linux?

A user is anyone with a login account on the Linux system. Users can access the system based on their permissions and roles.

Example: On a shared development server, each DevOps engineer has their own user account to isolate their files and settings.

Types of Users in Linux

a. System Users

Created automatically during installation or when system services/apps are installed.

These accounts usually don’t have login privileges.

Examples: root, apache, mysql

b. Normal Users
Created by system administrators or via scripts.

Used for actual human users who log in and interact with the system.

Unique User Identification "UID"

Every user is assigned a UID.

UID Ranges:

  • 0: Reserved for the root user (superuser).

  • 1–999: Typically reserved for system users.

  • 1000+: Normal human users created manually or during OS setup.

Scenario: When setting file permissions or troubleshooting ownership, Linux refers to UIDs, not usernames.

Where Linux Stores User Account Info

  • /etc/passwd: Contains essential user account data.

  • /etc/shadow: Stores encrypted passwords and password expiry info.

Creating a User Account

Adds a new user to the system.

Creating a User Account

Setting or Changing a User Password

Image description

passwd sophia will prompt you to enter a new password.

Viewing User Account Properties

Image description

Sample output:

sophia❌1001:1001::/home/sophia:/bin/bash

Fields explained:

  • chielo: Username

  • x: Password placeholder (real password stored in /etc/shadow)

  • 1001: UID

  • 1001: GID (Group ID)

  • (empty): User full name or comment field

  • /home/chielo: Home directory

  • /bin/bash: Default shell

Viewing User Password Properties

Viewing User Password Properties
Sample output:

chielo:$6$bD...:20190:0:99999:7:::

Fields explained:

  • chielo: Username

  • $6$bD...: Encrypted password

  • 20190: Days since Jan 1, 1970 when password was last changed

  • 0: Minimum password age in days

  • 99999: Maximum password age in days

  • 7: Warning period before password expires

  • Empty fields: Password inactivity and expiry info

Switching Users

su
Temporarily switch to another user account.

Image description

Deleting a User Account

Remove the account but keep home directory:

userdel

Image description

Remove the account and delete home directory:
userdel -r

Image description

Example: After an employee leaves a company, an admin can delete their Linux user account with userdel -r to clean up space and revoke access.

Conclusion

User management in Linux is foundational for system security and multi-user environments. From creating users to understanding UID ranges and system files like /etc/passwd and /etc/shadow, getting comfortable with these operations is essential for anyone working on Linux systems.

Let’s Connect on LinkedIn

(https://www.linkedin.com/in/chiamaka-chielo?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app)

As I automate my journey into RHCE and Ansible, I’d love to connect with fellow learners and professionals. Feel free to reach out and join me as I share tips, resources, and insights throughout this 30-day challenge.

cloudwhistler #30daysLinuxchallenge

Top comments (2)

Collapse
 
musictus profile image
Sixtus_Okoro

Great breakdown. Good job Engr 🙏🏻

Collapse
 
chielo_chiamaka profile image
Chielo Chiamaka

Thank you 🙏