UBuntu sudo command: XXX isn't in the sudoers file. This incident would be reported.

Source: Internet
Author: User

"1" Analysis problem

The prompt content translates into Chinese namely: User xxx (generally the newly added user name) does not have permission to use sudo.

Workaround Modify the permissions of the new user by modifying the/etc/sudoers file.

"2" switch to root user mode

Command: Su-

Note: This command has a "-", which is different from Su.

When using the command "su" just switch to root, but not the root environment variable passed, or the current user's environment variables.

Using the "Su-" command will also switch the environment variables in the past (can be tested, two commands to see the environment variable $path), as if the root login.

"3" Modify the Write permission of the file

Command: chmod u+w/etc/sudoers

"4" Edit file contents

Command: Gedit/etc/sudoers

After opening the file, look for root all= (all) all this line

Add a line below this line:

XXX all= (All) all

where xxx is the user name. Remember to save.

"5" revoke write permission for the file

Command: chmod u-w/etc/sudoers

"6" validation issue. Switch to User xxx

Command: Su XXX

Enter the password for the user. The sudo command can be used normally.

Good good study,day day up.

Sequential Selection Cycle Summary

UBuntu sudo command: XXX isn't in the sudoers file. This incident would 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.