DSLDAP服务端host1
先将DSLDAP服务同步host2
以下都是在host2上面操作(和前面的open ldap相同)
1.yum安装ldap客户端
yum install nss-pam-ldapd openldap-clients openldap -y
2.#添加client服务器到LDAP服务,注意IP为host1的,只需要修改IP地址即可(DSLDAP端口默认是10389),dc修改成自己的域
authconfig --enablemkhomedir --disableldaptls --enableldap --enableldapauth --ldapserver="192.168.100.75:10389" --ldapbasedn="dc=linux,dc=com" --update
这个指令修改了/etc/nsswitch.conf 以及/etc/openldap/ldap.conf文件
如果出现,再执行一遍就可以
[root@henghe-69 ~]# authconfig --enableldap --enableldapauth --ldapserver="192.168.100.75:10389" --ldapbasedn="dc=linux,dc=com" --update
getsebool: SELinux is disabled
3.重启服务nslcd
systemctl restart nslcd
systemctl restart sshd
4.在ApacheDirectoryStudio页面修改DSLDAP服务端的schema参数,apacheds默认没有posixGroup 和posixAccount 的object class
5.通过ApacheDirectoryStudio创建linux同步用户,object class选择inetOrgPerson+posixAccount,创建用户组object class选择posixGroup (创建普通用户只选inetOrgPerson,创建ou选择organizationalUnit)。uidNumber和gidNumber值最好从2000之后开始,避免跟已经存在用户和用户组id重复,一旦重复,就会默认使用以前的。
创建用户的时候需要额外增加属性,loginShell值为/bin/bash,userPassword值为自己想要设定的值。
6.创建完如图
7.服务器上切换用户
su user
注意:不能开启禁止匿名访问(默认是允许匿名访问的,打√)