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