User Management¶
Create a User¶
Create a user account:
sudo useradd -m <username>
The -m option automatically creates the corresponding user home directory under /home.
Set the password:
sudo passwd <username>
After running this command, you will be prompted to enter the new password twice.
Update User Password¶
To update the password of the current user, run:passwd,Follow the prompts to enter the current password and the new password.
To update the password of another user, run:sudo passwd <username>,Follow the prompts to enter the new password.
Delete a User Account¶
When an existing user account is no longer needed, it can be deleted using the following command:
sudo userdel -r <username>
The -r option also removes the user’s home directory under /home and other related resources.