CentOS7添加sudoers
Add New System User in CentOS
adduser newuser
Create a Strong Password
passwd newuser
Add User to the Wheel Group in CentOS
The wheel group is a special user group that allows all members in the group to run all commands. Therefore, you need to add the new user to this group so it can run commands as superuser. You can do that by using the following command:
usermod -aG wheel newuser
Again, make sure you are using the name of the actual user instead of newuser. Now, use visudo to open and edit the /etc/sudoers file. Make sure that the line that starts with %wheel is not commented. It should look exactly like this:
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
Switch to the sudo User
su - newuser
The way to test this is to run the following command:
sudo whoami
root