PAM介绍
PAM(Pluggable Authentication Modules )是由Sun提出的一种认证机制。它通过提供一些动态链接库和一套统一的API,将系统提供的服务和该服务的认证方式分开,使得系统管理员可以灵活地根据需要给不同的服务配置不同的认证方式而无需更改服务程序,同时也便于向系统中添加新的认证手段。
PAM最初是集成在Solaris中,目前已移植到其它系统中,如Linux、SunOS、HP-UX 9.0等。
PAM实际上起一个认证代理的作用。各应用层服务程序把认证请求信息发送给PAM模块,PAM模块在/etc/pam.d/调用相应的服务文件,然户服务文件通过调用组文件模块(位于/lib/security/下)来进行认证。
/etc/pam.d下的文件存放的是各个命令的pam模块的配置,比如:
[root@Master ~]# ls /etc/pam.d/
chfn other runuser subscription-manager
chsh passwd runuser-l sudo
config-util password-auth smartcard-auth sudo-i
crond password-auth-ac smartcard-auth-ac su-l
fingerprint-auth poweroff smtp system-auth
fingerprint-auth-ac reboot smtp.postfix system-auth-ac
halt remote sshd
login rhn_register ssh-keycat
newrole run_init su

pam模块:
auth_pam_unix.so 用来验证用户和密码的
account_pam_unix.so 验证用户有没有过期
pam_rootok.so 判断当前用户是否为root
pam_nologin.so 拒绝非root用户登录
pam_access.so 限制用户访问终端
pam_time.so 拒绝某个时间段访问某个服务
/etc/security下的文件则对于每个pam模块又做了具体的配置,比如:parm_limits.so的配置文件就是/etc/security/limits.conf

浙公网安备 33010602011771号