Ubuntu is not in the sudoers file

Source: Internet
Author: User



When sudo is used, the system prompts "xxxis not in the sudoers file. this incident will be report ". XXX is your user name. this error indicates that your user name does not have permission to use sudo. We only need to modify the/etc/sudoers file.

The procedure is as follows:

Step 1: Use the Su-command to enter the super Mode

Jibo @ Linux $ su-

Root @ Linux $

Note:

Note that-This is different from Su. When the "Su" command is used, the system only switches to root, but does not pass the root environment variable to the current user, use the "Su-" command to bring the environment variables together, just like root logon.

Step 2: add the write permission to the sudoers file

Root @ Linux $ chmod U + w/etc/sudoers

Step 3: edit the/etc/sudoers file. Find this line: "rootall = (all) All" add "hostname all = (all) All" under the change line (Change hostname to your username), save and exit

Root @ Linux $ gedit/etc/sudoers

In the sudoers fileRoot all = (all) all add

Hostname all = (all) All

Step 4: revoke the write permission of the file.

Root @ Linux $ chmod U-W/etc/sudoers

Switch to the user mode.

 

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.