Problem with the sudoers file when using sudo command under Linux

Source: Internet
Author: User

Environment: VirtualBox4.1 + RedHat Linux 6

Question: When using the sudo command prompt "xxx is isn't in" Sudoers file. This incident'll bereported. where xxx is your username, which means your username does not have permission to use sudo command.

Resolve: Just modify the/etc/sudoers file on the line.

1. Enter Super User mode. That is, the input "su-", the system will allow you to enter the Super User password, enter the password after entering the Super User mode. (Note: You can also login directly with root);

2. Add Write permission to file, because sudoers this file is only allowed to read, not allowed to write. Enter the command "chmod u+w/etc/sudoers";

3. Edit the/etc/sudoers file. Enter the command "Vi/etc/sudoers", enter "I" into edit mode, and find this line: "Root all= (All)", add "xxxall= (All) all" (Here xxx is your username), and then press ESC to enter: Wq ", save exit;

4. Revoke the Write permission of the file and restore the read and write status of the file. Enter the command "chmod u-w/etc/sudoers".

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.