以下为CentOS Linux release 8.5.2111
系统/etc/pam.d/su
默认配置。
[root@localhost authselect]# cat /etc/pam.d/su
#%PAM-1.0
auth required pam_env.so
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
含义
auth required pam_env.so
: 这一行指定了在su命令执行时,需要使用pam_env模块来进行认证。pam_env模块用于设置用户环境变量。
auth sufficient pam_rootok.so
: 这一行指定了如果用户是root用户,即拥有root权限,则认证成功。如果用户不是root用户,则继续进行后续的认证。
auth substack system-auth
: 这一行指定了在认证过程中,将执行system-auth文件中定义的认证策略。
auth include postlogin
: 这一行指定了在认证过程中,将执行postlogin文件中定义的认证策略。
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
: 这一行指定了如果用户的UID为0(即root用户),则认证成功。如果用户不是root用户,则继续进行后续的认证。
account include system-auth
: 这一行指定了在账户验证阶段,将执行system-auth文件中定义的账户验证策略。
password include system-auth
: 这一行指定了在密码验证阶段,将执行system-auth文件中定义的密码验证策略。
session include system-auth
: 这一行指定了在会话管理阶段,将执行system-auth文件中定义的会话管理策略。
session include postlogin
: 这一行指定了在会话管理阶段,将执行postlogin文件中定义的会话管理策略。
session optional pam_xauth.so
: 这一行指定了在会话管理阶段,可选择性地执行pam_xauth.so模块来进行X认证,用于X窗口系统的认证。