1. First switch to the root user, enter the command
Su
2. Add the Write permission to the sudo file, and the command is:
chmod u+w/etc/sudoers
3. Edit the Sudoers file
Vi/etc/sudoers
Find root all= (all) all this line
In the "root all= (All) All" line, add one more line:
Evai all= (All) all
Where Evai is the user name you are currently using, that is, the user name of the normal user.
PS: Here you can sudoers add any one of the following four lines
Youuser all= (All) all
%youuser all= (All) all
Youuser all= (All) Nopasswd:all
%youuser all= (All) Nopasswd:all
First line: Allows the user to execute the sudo command youuser (requires a password).
second line: Allow user group Youuser inside user to execute sudo command (need to enter password).
line three: Allow the user to execute the sudo command youuser, and do not enter a password at the time of execution.
Line Fourth: Allow user group Youuser inside user to execute sudo command, and do not enter the password at the time of execution.
4. Revoke sudoers file Write permission, command:
chmod u-w/etc/sudoers
After saving, enter Exit to exit the root user.
This allows the normal user to perform some operations using sudo permissions.
CentOS Normal user set sudo permissions