User Managment
Here are some user management commands in Linux with examples:
Create a new user:
useradd john
This command creates a new user account named "john".
Set/change password for a user:
passwd john
This command allows you to set or change the password for the user "john".
Modify user properties:
usermod -aG sudo john
This command adds the user "john" to the "sudo" group, granting them administrative privileges.
Delete a user:
userdel john
This command deletes the user account "john".
Display user and group information:
id john
This command displays the user and group information for the user "john".
Switch to another user account:
su - john
This command allows you to switch to the user account "john".
Execute a command with administrative privileges:
sudo apt-get update
This command executes the "apt-get update" command with root privileges.
Configure password expiry information:
chage -l john
This command displays the password expiry information for the user "john".
Lock or unlock a user account:
usermod -L john
This command locks the user account "john".
usermod -U john
This command unlocks the user account "john".
Last updated