Xxx is not in the sudoers file. This incident will be reported. solution, sudoersfile. this

Source: Internet
Author: User

Xxx is not in the sudoers file. This incident will be reported. solution, sudoersfile. this

1. Switch to the root user

The su command switches between common users and root users, and the password set during installation must be entered;

2. Add the write permission for the sudo file. The command is:
Chmod u + w/etc/sudoers

3. Edit the sudoers file
Vi/etc/sudoers
Find this line of root ALL = (ALL) ALL, add xxx ALL = (ALL) ALL under it (here xxx is your user name)

Ps: You can add any of the following four lines to sudoers:
Youuser ALL = (ALL) ALL
% Youuser ALL = (ALL) ALL
Youuser ALL = (ALL) NOPASSWD: ALL
% Youuser ALL = (ALL) NOPASSWD: ALL

Line 1: allow the user youuser to execute the sudo command (password required ).
Line 2: Allow users in the user group youuser to execute the sudo command (password required ).
Row 3: allows the user youuser to execute the sudo command without entering the password during execution.
Row 4: Allow users in the user group youuser to execute the sudo command without entering the password during execution.

4. revoke the sudoers file write permission by running the following command:
Chmod u-w/etc/sudoers

In this way, general users can use sudo.

In addition, the Red Hat version adds a line number for linux. After the above-mentioned sudo user is added

$: Sudo vi/etc/vimrc

Add: set nu at the end of the document, save and exit.

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.