无法登录 Lubuntu 桌面 openLDAP

无法登录 Lubuntu 桌面 openLDAP

我们的管理员正在尝试为一些网络机器安装 openLDAP 系统。

我在这里列出所有步骤,以便有人可以指出重大错误。

客观的

  1. 使用 Ubuntu 服务器和 lubuntu 客户端设置集中式身份验证系统。

  2. 用户应该将他们的个人目录保存在服务器上,并可在登录的每个客户端上访问。

错误

  1. 经过以下步骤后,openLDAP 用户test1可以通过终端登录,但桌面登录不断循环并返回。

  2. 任何新用户“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
  1. Lubuntu 客户端是通过网络 PXE 启动安装的,安装文件是通过 缓存的apt-cacher-ng
  2. 预置文件向客户端提供了一些 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
    
  3. 服务器和客户端都是普通的 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 ..
    

服务器步骤

  1. 在服务器上安装openLDAPsudo apt-get install slapd ldap-utils并指定管理员密码

  2. 编辑配置文件以反映新域sudo nano /etc/ldap/ldap.conf

    BASE dc=organization,dc=lin
    URI ldap://192.168.0.55
    
  3. 运行配置助手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
    
  4. 测试 LDAP 服务器sudo ldapsearch -x并验证设置

  5. 已安装 phpLDAPAdminsudo apt-get install phpldapadmin

  6. 创建符号链接sudo ln -s /usr/share/phpldapadmin/ /var/www/phpldapadmin

  7. 编辑 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');
    
  8. 重新启动 Apache 服务“sudo /etc/init.d/apache2 restart”

  9. 打开端口“sudo ufw allow 80”和“sudo ufw allow 389”

  10. 尝试登录 phpLDAP Adminhttp://192.168.0.55/phpldapadmin/

    Login DN : cn=admin,dc=organization,dc=lin
    Password : <adminPassword>
    
  11. 现在测试了 phpLDAPAdmin

    Created a POSIX group - Employees
    Created a POSIX Account below it - test1 / password1
    
  12. 用户的主目录是/home/users/test1

客户端步骤

  1. 安装sudo apt-get install libnss-ldap libpam-ldap ldap-utils ldap-auth-client nscd在客户端

  2. 编辑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
    
  3. 编辑sudo nano /etc/ldap.secret并输入以下信息:<adminPassword>

  4. 安全文件sudo chmod 600 /etc/ldap.secret

  5. 运行“sudo auth-client-config -t nss -p lac_ldap”

  6. 已编辑sudo nano /etc/pam.d/common-password

  7. 将第 26 行设置为password [success=1 user_unknown=ignore default=die] pam_ldap.so use_authtok try_first_pass

  8. 创建目录sudo mkdir /home/users

  9. 已安装 NFS-Commonsudo apt-get install nfs-common

  10. 编辑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

https://help.ubuntu.com/community/InstallingphpLDAPadmin

答案1

我觉得错误不在于 LDAP,而在于自动创建新用户的主目录。根据Debian 维基

/etc/pam.d/common-session如果您想在用户首次登录时自动创建主目录,请包括以下代码:

session     required      pam_mkhomedir.so skel=/etc/skel umask=0022

请注意,只要无法写入主目录,就会循环回到登录屏幕 - 这可能是因为该目录不存在,或者没有写入权限,或者磁盘配额已满等。

相关内容