New users in Linux cannot use the sudo command problem: ROOTR is isn't in the sudoers file. This incident'll be reported resolved

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.