Ref: 39501025
If the user executing the sudo command does not have sudo permission, the following error is reported when executing the sudo command
[email protected]]# sudo yum install gcc-c++
ROOTR is not in the sudoers file. This incident'll be reported
Set the user to execute sudo command permissions, it is recommended that these operations are performed within SECURECRT otherwise, the problem occurs when you go to the sudoers step
Here's how:
1. Enter Super User mode. That is, enter "Su-", the system will let you enter the super user password, enter the password and enter the Super User mode.
2. Add Write permission to the file. That is, enter the command "chmod u+w/etc/sudoers".
3, edit the/etc/sudoers file. That is, enter the command "Vim/etc/sudoers", enter "I" into the edit mode,
Find this line: "Root all= (All) all" in the following add "XXX all= (All) all" (Here xxx is your user name), such as I here is ROOTR so my statement is: ROOTR all= (All) all
If you want to do not need to enter a password, then find the following sentence
#%wheel all= (All) Nopasswd:all
and remove the comment #:
%wheel all= (All) Nopasswd:all
then save (just press the ESC key and enter ": Wq") to exit.
4. Adjust your user (normal user) to the "wheel" user group.
gpasswd-a yourusername Wheel
this way, you can no longer enter a password each time you execute the sudo command
5, revoke the Write permission of the file. This is the input command "chmod u-w/etc/sudoers".
[[email protected]]$ su root
[email protected]]# chmod u+w/etc/sudoers
[email protected]]# vim/etc/sudoers
[email protected]]# chmod u-w/etc/sudoers
[email protected]]# gpasswd-a ROOTR wheel
[email protected]]# su ROOTR
:
After that you can execute sudo, souvenir:
New users in Linux cannot use the sudo command problem: ROOTR is isn't in the sudoers file. This incident'll be reported resolved