How to Add, Manage and Delete Users on CentOS 7

The root user has unlimited privileges and can execute any command that may even accidentally damage your server. You can create a new user account with limited access. The sudo command provides a mechanism for granting administrator privileges to this new user.

If your new user should have the ability to execute commands with root (administrative) privileges, you need to give the new user access to sudo. You can do this by adding the user to the wheel group.

Log in to your server as the root user and follow the steps:

1. To add a new user to your system:

adduser username

2. To update password of the user:

passwd username

You need to set and confirm the password at the prompt.

3. To add the user to the wheel group:

usermod -aG wheel username

On CentOS, by default, all members of the wheel group have sudo privileges.

Deleting Users

If you want to delete the user without deleting any of their files, login as root user and type the following command:

userdel username

Effective user management will allow you to separate users and give them only the access that is needed for them to do their job.