http://www.ibm.com/developerworks/cn/linux/l-pam/
http://docs.oracle.com/cd/E19253-01/819-7056/ch3pam-01/index.html
打开/etc/pam.d/目录下的任何一个配置文件,其中每行的验证规则都使用如下所示的语法格式:
Type Control-flag Module-path Module-arguments
其中每行代表一个独立的验证方式,每个配置文件可以由多种验证规则相互叠加而成。验证时PAM-API会按照从上往下的方式一一读取这些验证规则,并根据其中的控制标志做出相应的动作。
required 某个失败,继续往下,直到所有完成后。
requisite 某个失败,所有结束
sufficient 某个成功,所有结束
验证服务模块-用于授予用户访问帐户或服务的权限。提供此服务的模块可以验证用户并设置用户凭证。
帐户管理模块-用于确定当前用户的帐户是否有效。提供此服务的模块可以检查口令或帐户的失效期以及限时访问。
会话管理模块-用于设置和终止登录会话。
口令管理模块-用于强制实施口令强度规则并执行验证令牌更新。
[[email protected] pam.d]# cat sshd
#%PAM-1.0
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth
[[email protected] pam.d]# cat password-auth-ac
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_unix.so
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3 type=
password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
[[email protected] pam.d]# cat login
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
-session optional pam_ck_connector.so