OS version:Red Hat Enterprise Linux Server release 6.4
Kernel version:2.6.32-358.el6.x86_64
-------------------------------------------------------------------------
准备工作:
[root@Zhai ~]# env | grep pam_env_test1
[root@Zhai ~]# env | grep pam_env_test2
[root@Zhai ~]# env | grep pam_env_test3
[root@Zhai ~]# env | grep pam_env_test4
[root@Zhai ~]# su - pam_test1
[pam_test1@Zhai ~]$ env | grep pam_env_test1
[pam_test1@Zhai ~]$ env | grep pam_env_test2
[pam_test1@Zhai ~]$ env | grep pam_env_test3
[pam_test1@Zhai ~]$ env | grep pam_env_test4
验证1:
[root@Zhai ~]# vi /etc/pam.d/su
[root@Zhai ~]# vi /etc/security/pam_env.conf
pam_env_test1 DEFAULT=Zhai_kang pam_env_test2 DEFAULT="Zhai_kang 2013" pam_env_test3 DEFAULT="Zhai_kang 201311" OVERRIDE=${pam_env_test1} pam_env_test4 DEFAULT=zhai_kang:201311\ 17,19:30:00验证2:
[root@Zhai ~]# cat /etc/security/pam_env.conf
[root@Zhai ~]# vi /etc/environment
pam_env_test4="----Zhai_kang V----" pam_test5="Kang_Zhai 2013"[root@Zhai ~]# vi /etc/pam.d/su
#%PAM-1.0 auth required pam_unix.so account required pam_unix.so session required pam_env.so conffile=/etc/security/pam_env.conf envfile=/etc/environment readenv=1验证3:
[root@Zhai ~]# cat /etc/security/pam_env.conf
[root@Zhai ~]# cat /etc/environment
pam_env_test4="----Zhai_kang V----" pam_test5="Kang_Zhai 2013"[root@Zhai ~]# vi /etc/pam.d/su
#%PAM-1.0 auth required pam_unix.so account required pam_unix.so session required pam_env.so conffile=/etc/security/pam_env.conf envfile=/etc/environment readenv=1 user_envfile=.pam_environment user_readenv=1[pam_test1@Zhai ~]$ vi .pam_environment
pam_env_test1=------20131127-21:13:00------------- pam_env_test4=----vvv-vvvV---- pam_test=----vvv-----------------------------------------------------------------------------
The detailed information:man pam_env
The detailed information:man pam_env.conf