User Management in Linux
What is User Management?
What is User and Group?
What is home directory and login shell?
Common user management commands.
Files like /etc/passwd, /etc/group, /etc/shadow.
User Management in Linux means creating, modifying, and controlling user
accounts and their access to the system. It ensures that each person or process
using the system has a unique identity (a user account).
User management is part of system administration, which means it’s usually
handled by someone with root or sudo privileges , like a Linux administrator,
DevOps engineer, or system admin.
What is a User and Group?
A User in Linux is an account that allows someone to log in and use the system.
Every user has:
A unique username
A User ID (UID)
A home directory (like /home/priya)
A login shell (like /bin/bash)
Each user can have their own files, settings, and permissions.
A Group is a collection of [Link]’s used to manage permissions for multiple users at once.
So instead of giving permissions to each user individually,you can give them to a group, and all
members inherit that access.
What is a Home directory and login shell?
The home directory is the personal working space for each user in Linux.
It’s where all your personal files, configurations, and settings are stored.
Example:
For user priya → /home/priya
The login shell is the program that runs when a user logs into Linux.
It provides the command-line interface where you type your commands.
Common shells:
/bin/bash → Most common shell (Bash shell)
/bin/sh → Basic shell
/bin/zsh → Popular modern shell (used in macOS too)
Create a user
useradd <username>
useradd -g <groupname> -s /bin/bash -m -d <home_dir> <username>
Set password
passwd <username>
Delete a user
deluser <username>
deluser --remove-home <username> - Deletes the user and also its home dir
Create a group
groupadd <groupname>
Add user to a group
usermod -aG <groupname> <username>
Removes a user from a group
gpasswd -d username groupname
Delete group
groupdel <groupname>
File where Linux stores user information.
/etc/passwd
It has 7 fields separated by colons : like this 👇
Username:Password placeholder:UserID:GroupID:Comment:Home Directory:Login Shell
Example -
priya:x:1001:1001:Priya Singh:/home/priya:/bin/bash
File where Linux stores information about all groups on the system.
/etc/group
It has 4 fields, separated by colons : like this 👇
group_name : password_placeholder : GID : users
Example -
devloper:x:1003:priya
.
File where Linux stores the encrypted passwords.
/etc/shadow
It has 8 fields, separated by colons : like this 👇
Username:Encrypted Password:Date of last password change:Min Age:Max Age:Warning Period:Inactive
Period:Expiry Date
Exmaple-
priya:$6$xyz987$askjdhf87dhfh:20000:0:99999:7:::