Error environment: rehl x. x.
If you run the sudo command under a common user, the following error occurs: llhtiger is not in the sudoers file. This incident will be reported. solution:
I,$Whereis sudoers ------- locate the file location. The default value is/etc/sudoers.
II,#Chmod U + w/etc/sudoers -------- log on to Su-root as a Super User, modify the File Permission to grant the write permission to the file (LS-Al/etc/sudoers can view the original file permission)
III,#Gedit/etc/sudoers ----- edit the file;
InRoot all = (all) AllAdd under row
Xxx all = (all) All
XxxYour username.
IV,#Chmod U-W/etc/sudoers --------- return to the original file permission!
The following is a little more detailed:
Because the root user is disabled in Ubuntu, the user created during system installation is added to sudoers by default. However, in RedHat and centos, users other than root users are not added to sudoers by default. In this way, when executing the sudo command, an error such as XXX is not in the sudoers file. This incident will be reported. will appear. For the sake of security, we advocate the use of common users for daily operations, and the use of sudo when super users are needed. In this way, we need to add some users to sudoers.
In fact, it is very easy to add users to sudoers.
1. First, use the whereis command to find the directory of the sudoers configuration file (the directory will be in/etc/sudoers by default)
[Root @ virtualpc gyl] # whereis sudoers
Sudoers:/etc/sudoers. bak/usr/share/man/man5/sudoers.5.gz
2. Switch to the root user and change the/etc/sudoers permission.
[Root @ virtualpc gyl] # chmod U + w/etc/sudoers
3. Then you can use the VI editor to add users to sudoers.
[Root @ virtualpc gyl] # vi/etc/sudoers
4. Locate root all = (all) All and add the user to the file,
TIPS: By the way, the VI editor is used. When entering the VI editor, you can move the cursor by using the direction key. Find the position to be edited, press "I", and then enter the insert mode, in this case, you can enter or delete characters. After editing, press "ESC" to exit the insert mode and enter the command line mode. Press ":" to enter the last line mode, and enter "WQ" to save and exit.
The following is the added result.
# Allow root to run any commands anywhere
Root all = (all) All
Gyl all = (all) All (this line is added, and gyl is my user name)
Then remove the write permission of sudoers (otherwise, the suoders file cannot be executed ):
[Root @ virtualpc gyl] # chmod U-W/etc/sudoers
Now, after exiting the root user, you can use the sudo command to execute super user permissions.
The reprinted ''' source has been lost, TKs.