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.