sudo user free sudo password

Source: Internet
Author: User
Tags exit in

Recently has been looking at how to create sudo user and free of sudo password, found a lot of information, the results found is not OK. And I cracked it today!

Environment: CentOS 6.6

1. First you have a regular user who executes sudo.

[Email protected] ~]# useradd Chengcai

2. Log in as root, and then modify the/etc/sudoers file:

Vim/etc/sudoers

####################################################################

# allow ROOT to run any commands anywhere

Root all= (All) all


# # allows members of the ' sys ' group to run networking, software,

# # Service Management apps and more.

#%sys all = NETWORKING, software, SERVICES, STORAGE, delegating, PROCESSES, LOCATE, DRIVERS


# # allows people in group wheel to run all commands

#%wheel all= (All) all


# # Same thing without a password

%wheel all= (All) nopasswd:all #将此行的 # Delete.

####################################################################

3. Add your regular users to the wheel group:

[Email protected] ~]# usermod-g wheel Chengcai #将chengcai用户加入到wheel组中

4. Modify the contents of the/etc/sudoers.d/waagent file:

[[email protected] ~]# vim/etc/sudoers.d/waagent #由于之前一直没改这个文件, appears the first time with a normal user Chengcai perform sudo-i when the first need to enter a password, and then Exit exit in execution Sudo-i no password is required. ()

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/90/wKioL1YBIXXAX7NqAACKwpe6D3U433.jpg "title=" QQ picture 20150922171407.png "alt=" Wkiol1ybixxax7nqaackwpe6d3u433.jpg "/>

####################################################################

#chengcai all = (all) all #这一行内容中添加免密码如下:

Chengcai all = (All) nopasswd:all

####################################################################

Remarks: There may be a system problem, for CentOS in/etc/sudoers.d/under the Waagent file, but for the Redhat system does not have this file, step four is based on the CentOS system, for the Redhat system only the first three steps.

5. Verify: Log in with a normal user, and then enter Sudo-i or sudo su root without requiring a password.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/92/wKiom1YBHNTgCspuAABxd0xNjy0455.jpg "title=" QQ picture 20150922171407.png "alt=" Wkiom1ybhntgcspuaabxd0xnjy0455.jpg "/>

This article is from the "aestheticism" blog, make sure to keep this source http://cctian.blog.51cto.com/10445650/1697177

sudo user free sudo password

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.