User Management
User management in Linux is a critical aspect of system administration. It involves creating, modifying, and managing user accounts and groups to ensure proper access control, system security, and resource allocation. Each user is assigned a unique identity, along with permissions and restrictions.
Add user:
adduser
Delete user:
deluser
Add group:
groupadd
Delete group:
groupdel
Change user password:
passwd
Lock/unlock user password:
passwd -l passwd -u
Switch user:
su
Show user information:
id
- Change user password
1. Type this command to change user password.
sudo passwd username
2. Enter new password. Then, you will be ask to retype your new password.
3. Your password is changed successfully.
- Manage password aging and expiration
The sudo chage command is used in Linux to manage password aging and expiration policies for a user. It allows administrators to define and control how long a user's password remains valid, enforce password expiration, and specify warnings before password expiration.
The syntax is: sudo chage [option] username
1. Displays the current password aging information.
sudo chage -l username
2. Set the account expiration date.
sudo chage -E 2025-12-31 username
The account will be disabled after this 2025-12-31. To set account expiration to never:
sudo change -E -1 username
3. Set a warning to the user 7 days before the password expires.
sudo chage -W 7 username
Good user management is essential to make sure your system stay secure from unknown intruders.
