Centos7 switch root user set no password

Source: Internet
Author: User
In centos7, whenever we use a common user to switch to the root user, a password is prompted. However, in some cases (such as personal computers), it may be a little troublesome. Therefore, it is necessary to switch root without a password. Centos7/rhel7 users can follow the configuration file changes to achieve: Configuration File name:/etc/pam. d/su file changes before the content is as follows: # % PAM-1.0auth & nbsp

In centos7, whenever we use a common user to switch to the root user, a password is prompted. However, in some cases (such as personal computers), it may be a little troublesome.

Therefore, it is necessary to switch root without a password.

Centos7/rhel7 users can change the configuration file:

Configuration File name:

/Etc/pam. d/su

Before the file is changed, the content is as follows:

# % PAM-1.0
Auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
# Auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# Auth required pam_wheel.so use_uid
Auth substack system-auth
Auth include postlogin
Account sufficient pam_succeed_if.so uid = 0 use_uid quiet
Account include system-auth
Password include system-auth
Session include system-auth
Session include postlogin
Session optional pam_xauth.so

After modification:

# % PAM-1.0
Auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
Auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
Auth required pam_wheel.so use_uid
Auth substack system-auth
Auth include postlogin
Account sufficient pam_succeed_if.so uid = 0 use_uid quiet
Account include system-auth
Password include system-auth
Session include system-auth
Session include postlogin
Session optional pam_xauth.s

You only need to pay attention to the four lines marked with red. From this, we can also see that this is the system configuration, which can be implemented with slight modifications.

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.