Solution that the user is not in the sudoers file

Source: Internet
Author: User

During the use of the Linux system, we usually use common users for routine operations, while the root user is only used for permission assignment and system settings, the password of the root user cannot be disclosed. When a common user executes a system program, he or she needs to temporarily escalate permissions. sudo is a common command. He or she only needs to enter the current user password to temporarily escalate permissions. When using the sudo command, we often encounter prompts that the current user is not in the sudoers file. What if this problem is solved? The following steps can be used to solve the problem easily.

1. Switch to the root user permission

Last login: Tue Sep 24 20:50:51 2013 from 192.168.30.171
[User @ Compile ~] $ Su root
Password:
[Root @ Compile user] #

2. View/etc/sudoers file permissions. If you have read-only permissions, change them to writable permissions.

[Root @ Compile user] # ls-l/etc/sudoers
-R -- r -----. 1 root 4030 September 25 00:57/etc/sudoers
[Root @ Compile user] # chmod 777/etc/sudoers
[Root @ Compile user] # ls-l/etc/sudoers
-Rwxrwxrwx. 1 root 4030 00:57/etc/sudoers
[Root @ Compile user] #

3. Execute the vi command, edit the/etc/sudoers file, and add the user who wants to escalate permissions. Find root in the file.

Root ALL = (ALL) ALL
User ALL = (ALL) ALL

Note: The format is (host in the User Name Network = (target user who executes the command) Command Execution range)

4. Save and exit, and restore the access permission of/etc/sudoers to 440.

[Root @ Compile user] # chmod 440/etc/sudoers
[Root @ Compile user] # ls-l/etc/sudoers
-R -- r -----. 1 root 4030 September 25 00:57/etc/sudoers
[Root @ Compile user] #

5. Switch to a common user to test the User Privilege Escalation function.

 

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.