0

How to add a normal user into the sudoers file On CentOS 7.6

Hello.I want to add a normal user into the wheel group on centos 7.6. How to execute the commands with root privileges?

CentOS Sudo Add a comment
connor
asked May 31 2019

Answer

0

To add a user and assign a password for the user

useradd <username>

passwd <username>

if you want to add an existed user into the wheel group,

usermod -aG wheel <username>

if you want to add a new user and also at the same time wanted to add a user into the wheel group,
useradd -G wheel <newuser>
passwd <newuser>

after setting the password, switch over to the user's account
su - <usernane>
Now execute the command with sudo as follows:
sudo ls -la /root
It prompts for a current logged in user's password.enter the password once to view the output of the command that you requested.
Thus user has got the root privilges and added into the wheel group.

Add a comment
linuxhelp
asked May 31 2019
Post your Answer