How to add and manage user accounts in CentOS 7?
In CentOS7, the following commands can be used to add and manage user accounts:
- You can add a user account using the following command.
sudo adduser username
This command will create a new user account and prompt you to set a password and other relevant information.
- You can modify user account information using the following commands:
sudo usermod -aG groupname username
This command adds the user to the specified user group.
- Remove user account: You can delete a user account using the following command:
sudo userdel -r username
This command will delete the user account along with its associated files and directories.
- Change User Password: The following command can be used to modify a user’s password.
sudo passwd username
This command will prompt you to enter and confirm a new password.
- Switch user account: You can use the following command to switch user accounts:
su username
This command will switch to the specified user account, requiring the user password for verification.
With these commands, you can easily add and manage user accounts to ensure the smooth running of system security and administration.