User Management in Linux

Linux is a multi-user operating system, meaning multiple users can operate on a system simultaneously. Proper user management ensures security, controlled access, and system integrity.

Types of Users in Linux

Root User / Superuser: Has fu…


This content originally appeared on DEV Community and was authored by Omkar Sharma

Linux is a multi-user operating system, meaning multiple users can operate on a system simultaneously. Proper user management ensures security, controlled access, and system integrity.

Types of Users in Linux

  • Root User / Superuser: Has full control over the system. Can perform any task such as installing software, changing system settings, and managing other users.

  • Regular User / Standard User: Has limited access. Can read, write, and execute files, but restricted from critical system areas.

  • System User: Non-human users that run background services and processes. These accounts are intangible to regular users.

Key Files Involved in User Management

  • /etc/passwd – Stores user account details.
  • /etc/shadow – Stores encrypted user passwords.
  • /etc/group – Stores group information.
  • /etc/gshadow – Stores secure group details.

Commands for Creating Users and Groups

  • Create a new user:
  useradd username
  • Create a user with a specific UID:
  useradd -u UID username
  • Create a new group:
  groupadd groupname
  • Create a group with a specific GID:
  groupadd -g GID groupname

Managing User Passwords

  • To set or change a user’s password:
passwd username

Enforcing Password Policies

  • Password expiration: Set password expiry days
chage -M 90 username
  • Lock a user account
passwd -l username

  • Unlock a user account
passwd -u username

Modifying Users and Groups

  • Change an existing username:
  usermod -l new_username old_username
  • Change an existing group name:
  groupmod -n new_groupname old_groupname
  • Check groups a user belongs to:
  groups username
  • Create a user with a specific UID and primary group (group must exist):
  useradd -u UID -g groupname username

or

  useradd -u UID -g GID username
  • Append a user to another group (without removing them from existing groups):
  usermod -aG groupname username
  • Change a user’s UID:
  usermod -u UID username
  • Change a user’s primary GID:
  usermod -g GID username

Deleting Users

  • To remove a user but keep their home directory:
userdel username
  • To remove a user and their home directory:
userdel -r username

Linux meme


This content originally appeared on DEV Community and was authored by Omkar Sharma


Print Share Comment Cite Upload Translate Updates
APA

Omkar Sharma | Sciencx (2025-04-27T04:33:36+00:00) User Management in Linux. Retrieved from https://www.scien.cx/2025/04/27/user-management-in-linux/

MLA
" » User Management in Linux." Omkar Sharma | Sciencx - Sunday April 27, 2025, https://www.scien.cx/2025/04/27/user-management-in-linux/
HARVARD
Omkar Sharma | Sciencx Sunday April 27, 2025 » User Management in Linux., viewed ,<https://www.scien.cx/2025/04/27/user-management-in-linux/>
VANCOUVER
Omkar Sharma | Sciencx - » User Management in Linux. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/04/27/user-management-in-linux/
CHICAGO
" » User Management in Linux." Omkar Sharma | Sciencx - Accessed . https://www.scien.cx/2025/04/27/user-management-in-linux/
IEEE
" » User Management in Linux." Omkar Sharma | Sciencx [Online]. Available: https://www.scien.cx/2025/04/27/user-management-in-linux/. [Accessed: ]
rf:citation
» User Management in Linux | Omkar Sharma | Sciencx | https://www.scien.cx/2025/04/27/user-management-in-linux/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.