Common user management tasks in Linux include:
-
Creating User Accounts: Adding new users to the system using the
useraddcommand.sudo useradd username -
Modifying User Accounts: Changing user attributes such as username, home directory, or group memberships using the
usermodcommand.sudo usermod -d /new/home/directory username -
Deleting User Accounts: Removing user accounts from the system with the
userdelcommand.sudo userdel username -
Changing Passwords: Updating user passwords using the
passwdcommand.sudo passwd username -
Managing User Groups: Creating, modifying, or deleting groups and adding users to groups using
groupadd,groupmod, andgroupdel.sudo groupadd groupname sudo usermod -aG groupname username -
Setting Account Expiration: Configuring when user accounts expire using the
chagecommand.sudo chage -E YYYY-MM-DD username -
Viewing User Information: Checking user details and group memberships with commands like
id,groups, and examining/etc/passwd.id username -
Locking and Unlocking Accounts: Disabling user accounts with
usermodorpasswd.sudo usermod -L username # Lock account sudo usermod -U username # Unlock account -
Monitoring User Activity: Using commands like
who,w, andlastto track user logins and activity.who
These tasks are essential for maintaining user accounts, ensuring security, and managing access control in a Linux environment.
