[Linux]-xxx is not in the sudoers file. The matter will be reported.

Source: Internet
Author: User

Redhat System:

The Create user command in Linux is: Useradd user name, Eg:useradd test

Specify password: passwd test

But sometimes we need to run a command with test to execute some root user, and there are two ways: the first, the method is executed with the test user and executed by the root user. Second, use the sudo command to give the user test a root permission temporarily. The first one we don't think about, the second is our main adoption method, but by default, the user does not have sudo permissions, this needs to be given by the root user. If nothing is done, the Execute sudo command will cause an exception: "Test is not in the sudoers file." The matter will be reported. "。

Log in to the system using the root user and view the file/etc/sudoers permissions information as shown below:

We can see that the permissions for this file at this time are the root user and the supper user group have Read permissions, other users do not have permissions. At this point, modify the file permissions for the root user to write, execute the command chmod u+w/etc/sudoers or execute chmod 640/etc/sudoers.

Modify the contents of the file: Vim/etc/sudoers, modify as follows:

The original

After adding the

Restore file permissions, command chmod u-w/etc/sudoers or execute chmod 440/etc/sudoers.

At this point, complete ... If not, then reboot.

[Linux]-xxx is not in the sudoers file. The matter will be reported.

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.