User Administration
User Account Management Workflow
User administration in Linux involves creating, modifying, and managing user accounts with precise control over system access and permissions.
Key User Management Commands
Command |
Function |
Usage |
adduser |
Create new user |
sudo adduser username |
usermod |
Modify user account |
sudo usermod -options username |
userdel |
Delete user account |
sudo userdel username |
passwd |
Change user password |
sudo passwd username |
User Creation Process
graph TD
A[User Creation] --> B[Generate Username]
A --> C[Create Home Directory]
A --> D[Set Initial Password]
A --> E[Assign User/Group ID]
User Account Creation Example
## Create a new user with specific configuration
sudo adduser --gecos "Developer,Office,Phone,Home" developer
sudo usermod -aG sudo developer
## Set account expiration
sudo chage -E 2024-12-31 developer
## Lock/Unlock user account
sudo passwd -l username ## Lock
sudo passwd -u username ## Unlock
Advanced User Configuration
## Display user account details
sudo chage -l username
## Configure password aging
sudo chage -M 90 -m 7 -W 14 username
User Account Lifecycle
stateDiagram-v2
[*] --> Created
Created --> Active
Active --> Inactive
Inactive --> Locked
Locked --> Deleted
Deleted --> [*]
Security Best Practices
## Restrict user login
sudo usermod -s /sbin/nologin username
## Monitor user activities
last
lastb
## View user details
cat /etc/passwd
cat /etc/shadow