zoukankan      html  css  js  c++  java
  • 04-openldap客户端安装

    阅读视图

    1. 基础环境准备
    2. 关闭sssd及安装nslcd客户端
    3. 配置nslcd客户端
    4. 启动nslcd进程
    5. 客户端验证
    6. ssh登录自动创建家目录

    1. 基础环境准备

    本文承接openldap服务端安装配置,基础环境请参考openldap服务端安装配置

    2. 关闭sssd及安装nslcd客户端

    1. 关闭sssd进程,由于我这最小化安装,并没有sssd进程

      [root@mldap01 ~]# service sssd stop && chkconfig sssd off
      sssd: unrecognized service 
      
    2. 安装OpenLDAP客户端软件包

      [root@test01 ~]# yum -y install openldap-clients nss-pam-ldapd
      

    3. 配置nslcd客户端

    1. 修改nslcd.conf配置文件,该文件是由nss-pam-ldapd包提供

      [root@test01 ~]# vim /etc/nslcd.conf
      uri ldap://mldap01.gdy.com
      base dc=gdy,dc=com
      ssl no
      tls_cacertdir /etc/openldap/certs
      [root@test01 ~]# rpm -qf /etc/nslcd.conf 
      nss-pam-ldapd-0.7.5-32.el6.x86_64
      
    2. 修改pam_ldap.conf配置文件,由pam_ldap包提供,pam_ldap

      [root@test01 ~]# vim /etc/pam_ldap.conf
      base dc=gdy,dc=com
      uri ldap://mldap01.gdy.com
      ssl no
      tls_cacertdir /etc/openldap/certs
      bind_policy soft
      [root@test01 ~]# rpm -qf /etc/pam_ldap.conf 
      pam_ldap-185-11.el6.x86_64
      
    3. 修改system-auth认证文件

      由pam包提供(系统自带包)

      [root@test01 ~]# rpm -qf /etc/pam.d/system-auth
      pam-1.1.1-24.el6.x86_64
      
    4. 修改nsswitch.conf配置文件

    5. 修改authconfig文件

      [root@test01 ~]# rpm -qf /etc/sysconfig/authconfig 
      authconfig-6.1.12-23.el6.x86_64
      [root@test01 ~]# vim /etc/sysconfig/authconfig
      USESHADOW=yes
      USELDAPAUTH=yes
      USELOCAUTHORIZE=yes
      USELDAP=yes
      

      选项解释如下

      USESHADOW=yes   //启用密码验证
      USELDAPAUTH=yes   //启用OpenLDAP验证
      USELOCAUTHORIZE=yes    //启用本地验证
      USELDAP=yes      //启用LDAP认证协议
      

    4. 启动nslcd进程

    ```shell
    [root@test01 ~]# /etc/init.d/nslcd restart
    Stopping nslcd:                                            [FAILED]
    Starting nslcd:                                            [  OK  ]
    [root@test01 ~]# chkconfig nslcd on
    [root@test01 ~]# chkconfig --list nslcd
    nslcd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
    ```
    

    5. 客户端验证

    1. 使用id命令或getent命令验证

      [root@test01 ~]# getent passwd user1            
      user1:x:501:501:user1:/home/user1:/bin/bash
      [root@test01 ~]# id user1
      uid=501(user1) gid=501(user1) groups=501(user1)
      [root@test01 ~]# cat /etc/passwd | grep user1
      
    2. 使用ssh登录验证

      [root@test01 ~]# ssh user1@127.0.0.1
      The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
      RSA key fingerprint is 1a:8a:57:12:ee:68:91:a4:bd:c5:48:f1:03:a9:5f:9c.
      Are you sure you want to continue connecting (yes/no)? yes
      Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
      user1@127.0.0.1's password: 
      Could not chdir to home directory /home/user1: No such file or directory
      -bash-4.1$ 
      

    6. ssh登录自动创建家目录

    1. 把/etc/ssh/sshd_config中的UsePAM设置成yes

    2. 在/etc/pam.d/sshd添加最后一行,加入这行的目的是ssh首次登录服务器时创建home目录

      此时ssh登录就会发现会自动创建home目录,并且权限为0700。

    3. 修改/etc/pam.d/password-auth

      这个还是需要加上,虽然不知道什么意思。如果不加上,openldap 密码策略时那一块总是通过ssh登录不上去。

    4. 重启sshd进程。最后不要忘记重启sshd进程。

    7. su到该用户下自动创建家目录

    修改system-auth认证文件,添加如下行。就搞定了。此时su - $user就会自动创建了。

  • 相关阅读:
    php开源项目学习二次开发的计划
    博客系统-程序结构-注册登录登出
    博客系统-3.0CodeIgniter系统SAE版本的配置 application/config/
    博客系统-模块结构
    DIN-A4 doublesided year calendar
    lua
    PGF基本图形对象
    Chinese Seals
    A Good Story for Great Friends
    Jack Clark 的几句名言
  • 原文地址:https://www.cnblogs.com/cishi/p/9127568.html
Copyright © 2011-2022 走看看