Resolution xx is not in the sudoers file sudoerslinux I use redhat5.4, the general user executes the sudo command prompts llhtiger is not in the sudoers file. this incident will be reported. solution: 1. $ whereis sudoers ------- locate the file location. The default values are/etc/sudoers 2. # chmod u + w/etc/sudoers. log on to su-root as a Super User, modify the File Permission to add the write permission limit for the file. ls-al/etc/sudoers can view the permissions of the original file. 3. Edit the vim/etc/sudoers file and add xxx all = (ALL) ALL and XXX as your username under the root ALL = (ALL) ALL line. Add method: Find the root line and press the "I" key to enter edit mode! After editing, the esc key enters normal mode and ": wq" is saved and exited! Finally, # chmod u-w/etc/sudoers returns to the original permission of the file! The following is a little more detailed: because the root user is disabled in ubuntu, the user created during system installation will be 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. First, use the whereis command to find the directory of the sudoers configuration file (in/etc/sudoers by default) [root @ localhost xiaofei] # whereis sudoerssudoers:/etc/sudoers. bak/usr/share/man/man5/sudoers.5.gz and then switch to the root user, change the permissions of/etc/sudoers [root @ localhost xiaofei] # chmod u + w/etc/sudoers, then you can use the vi editor to add users to sudoers [root @ localhost xiaofei] # vi/etc/sudoers and find root ALL = (ALL) the location where ALL is located. Add the user to the file. By the way, the vi editor is used. When you first enter the vi editor, you can move the cursor by using the arrow 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 anywhereroot ALL = (ALL) ALLxiaofei ALL = (ALL) ALL (this row is added, and xiaofei is my username) then remove the write permission of sudoers (otherwise, the suoders file cannot be executed): [root @ localhost xiaofei] # chmod u-w/etc/sudoers to this point, after exiting the root user, you can use the sudo command to execute the superuser permission.