首先建立jiachen的用户,jiachen属于自己的jiachen用户组
然后编辑文件/etc/pam.d/su 修改添加下面标红的部分,意思是允许jiachen组的所有用户可切换到root下。
#%PAM-1.0
auth sufficient pam_rootok.so
auth required pam_wheel.so group=jiachen
# 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 include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
这时随便添加一个用户,然后添加密码,试着去切换,是不行的,会报密码错误
假如这个用户你想让它能够切换到root下,就要将其添加到jiachen的组中
usermod -G jiachen xxx