两种部署方式
- libnss-ldapd + libpam-ldapd
- libnss-ldap + libpam-ldap
libnss-ldapd + libpam-ldapd(nslcd)
下载libnss-ldapd
libpam-ldapd
及依赖 nslcd
1 | root@jpvps:/var/cache/apt/archives# apt -d install libnss-ldapd |
解压deb包查看每个包主要做了什么
例如:dpkg -X libnss-ldapd_0.9.9-1_amd64.deb libnss
内容dpkg -e libnss-ldapd_0.9.9-1_amd64.deb libnss/DEBIAN
控制信息
libnss-ldapd
- /etc/nsswitch.conf 增加ldap配置
- /lib/x86_64-linux-gnu/libnss_ldap.so.2
libpam-ldapd
- 基于/usr/share/pam-configs/ldap, /etc/pam.d/增加ldap相关配置
- /lib/x86_64-linux-gnu/security/pam_ldap.so
nslcd
- nslcd 守护进程
- /etc/nslcd.conf 按实际配置即可
相关deb包安装并配置后进行测试
1 | root@jpvps:/etc/pam.d# su - tom |
自动创建家目录pam_mkhomedir.so
/etc/pam.d/common-session 增加
1 | session required pam_mkhomedir.so skel=/etc/skel/ umask=0077 |
再次测试
1 | root@jpvps:/etc/pam.d# su - tom |
/etc/pam.d/ 配置变动
PS: nslcd自带pam模块, 不用ldap.conf配置; /etc/pam.d/相关配置其实未实际起作用
libnss_ldap + libpam_ldap
下载libnss-ldap
libpam-ldap
及依赖
下载后可以看到5个deb包
1 | root@jpvps:/var/cache/apt/archives# apt -d install libpam-ldap |
同样解压分别看看每个deb包做了什么
libnss-ldap
libpam-ldap
ldap-auth-client
ldap-auth-config
aut-client
/etc/pam.d/ 变更
config=/etc/ldap.conf
为手工编辑添加
1 | diff --git a/common-account b/common-account |
/etc/ldap.conf 内容
1 | root@jpvps:/etc/pam.d# cat /etc/ldap.conf |
其中nss_initgroups_ignoreusers ...
为/etc/init.d/libnss-ldap更新
/etc/nsswitch.conf 变更
1 | passwd: compat systemd ldap |