我们的管理员正在尝试为一些网络机器安装 openLDAP 系统。
我在这里列出所有步骤,以便有人可以指出重大错误。
客观的
使用 Ubuntu 服务器和 lubuntu 客户端设置集中式身份验证系统。
用户应该将他们的个人目录保存在服务器上,并可在登录的每个客户端上访问。
错误
经过以下步骤后,openLDAP 用户
test1
可以通过终端登录,但桌面登录不断循环并返回。任何新用户“test2”(无需在客户端机器上创建文件夹) 在服务器上创建在客户端引发错误:
Could not chdir to home directory /home/users/test2: No such file or director
设置
使用 Ubuntu Server 13.04 和 Lubuntu 13.10 客户端
Server IP : 192.168.0.55
Client IP : 192.168.0.100
- Lubuntu 客户端是通过网络 PXE 启动安装的,安装文件是通过 缓存的
apt-cacher-ng
。 预置文件向客户端提供了一些 openLDAP 详细信息
ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap://192.168.0.55 ldap-auth-config ldap-auth-config/ldapns/base-dn string dc=organization,dc=lin ldap-auth-config ldap-auth-config/ldapns/ldap_version select 3 ldap-auth-config ldap-auth-config/dbrootlogin boolean yes ldap-auth-config ldap-auth-config/dblogin boolean false ldap-auth-config ldap-auth-config/rootbinddn string cn=admin,dc=organization,dc=lin
服务器和客户端都是普通的 VirtualBox VM,不涉及任何花哨的硬件。已检查
ls -lah
。输出为:total 8.0K drwxr-xr-x 2 root root 4.0K Jul 21 09:20 . drwxr-xr-x 3 root root 4.0K Jul 21 09:20 ..
服务器步骤
在服务器上安装openLDAP
sudo apt-get install slapd ldap-utils
并指定管理员密码编辑配置文件以反映新域
sudo nano /etc/ldap/ldap.conf
:BASE dc=organization,dc=lin URI ldap://192.168.0.55
运行配置助手
sudo dpkg-reconfigure slapd
? Omit Server Configuration - No ? DNS Domain Name - organization.lin ? Organization Name - Organization Name ? Admin Password - <adminPassword> and re-enter ? Back-end Database - HDB ? Remove Database - Yes ? Move Old Database - Yes ? Allow LDAPv2 - No
测试 LDAP 服务器
sudo ldapsearch -x
并验证设置已安装 phpLDAPAdmin
sudo apt-get install phpldapadmin
创建符号链接
sudo ln -s /usr/share/phpldapadmin/ /var/www/phpldapadmin
编辑 phpLDAP 配置
sudo nano /etc/phpldapadmin/config.php
并设置以下内容$servers->setValue('server','name','Organization LDAP Server'); $servers->setValue('server','host','192.168.0.55'); $servers->setValue('server','base',array('dc=organization,dc=lin')); $servers->setValue('login','bind_id','cn=admin,dc=organization,dc=lin');
重新启动 Apache 服务“sudo /etc/init.d/apache2 restart”
打开端口“sudo ufw allow 80”和“sudo ufw allow 389”
尝试登录 phpLDAP Admin
http://192.168.0.55/phpldapadmin/
Login DN : cn=admin,dc=organization,dc=lin Password : <adminPassword>
现在测试了 phpLDAPAdmin
Created a POSIX group - Employees Created a POSIX Account below it - test1 / password1
用户的主目录是
/home/users/test1
客户端步骤
安装
sudo apt-get install libnss-ldap libpam-ldap ldap-utils ldap-auth-client nscd
在客户端编辑
sudo nano /etc/ldap.conf
并输入以下信息:base dc=organization,dc=lin uri ldap://192.168.0.55/ ldap_version 3 rootbinddn cn=admin,dc=organization,dc=lin pam_password md5
编辑
sudo nano /etc/ldap.secret
并输入以下信息:<adminPassword>
安全文件
sudo chmod 600 /etc/ldap.secret
运行“sudo auth-client-config -t nss -p lac_ldap”
已编辑
sudo nano /etc/pam.d/common-password
将第 26 行设置为
password [success=1 user_unknown=ignore default=die] pam_ldap.so use_authtok try_first_pass
创建目录
sudo mkdir /home/users
已安装 NFS-Common
sudo apt-get install nfs-common
编辑
sudo nano /etc/fstab
并输入以下内容:192.168.0.55:/home/users/ /home/users/ nfs rsize=8192,wsize=8192, timeo=14,intr
参考
http://www.unixmen.com/openldap-installation-configuration-ubuntu-12-1013-0413-10-debian-67-2/
http://www.unixmen.com/configure-linux-clients-authenticate-using-openldap/
http://www.unixmen.com/openldap-installation-configuration-ubuntu-12-1013-0413-10-debian-67/
https://help.ubuntu.com/lts/serverguide/openldap-server.html
答案1
我觉得错误不在于 LDAP,而在于自动创建新用户的主目录。根据Debian 维基:
/etc/pam.d/common-session
如果您想在用户首次登录时自动创建主目录,请包括以下代码:session required pam_mkhomedir.so skel=/etc/skel umask=0022
请注意,只要无法写入主目录,就会循环回到登录屏幕 - 这可能是因为该目录不存在,或者没有写入权限,或者磁盘配额已满等。