How to add sudo user on CentOS 7

Scenario: add sudo user on CentOS 7
System: CentOS 7

Steps to Create a New Sudo User
– Log in to your server as the root user.
– Use the adduser command to add a new user to your system,example add user with username bachem.

– By default, on CentOS, members of the wheel group have sudo privileges,use the usermod command to add the user bachem to the wheel group.

– Test sudo access on new user account, use the su command to switch to the new user account.
As the new user, verify that you can use sudo by prepending “sudo” to the command that you want to run with superuser privileges.
The first time you use sudo in a session, you will be prompted for the password of the user account. Enter the password to proceed.
If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *