CentOS prompts users not to resolve in the sudoers file using sudo

Source: Internet
Author: User

1 Switch to root user
[[email protected] ~]$ su root
Password:
[Email protected] ~]#


2 View/etc/sudoers file permissions, if read-only permission, modify to writable permission

[Email protected] ~]# ll/etc/sudoers
-r--r-----. 1 root root 4030 December 09:55/etc/sudoers
[Email protected] ~]# chmod 777/etc/sudoers
[Email protected] ~]# ls-l/etc/sudoers
-rwxrwxrwx. 1 root root 4030 December 09:57/etc/sudoers


3 Modify the/etc/sudoers file and execute the following command:

/*username is your user name */
[[email protected] ~]# echo ' username all= (All) all ' >>/etc/sudoers
or root, enter Visudo or vim/etc/sudoers, find the root all= (all) all field, append to the next line:
Username all= (All) all

After 5 minutes the password expires, next time you need to re-enter, if you do not want to be so troublesome, you can use the following methods
Username all= (All) Nopasswd:all


Description: The format of the {user name Network host = (the target user executing the command) execution of the command range}

4 Save exit, and restore/etc/sudoers access rights to 440

[Email protected] ~]# chmod 440/etc/sudoers
[Email protected] ~]# ll/etc/sudoers
-r--r-----. 1 root root 4030 December 09:59/etc/sudoers


5 switch to normal user, test user privilege elevation function

CentOS prompts users not to resolve in the sudoers file using sudo

Related Article

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.