Linux 使用LDAP賬戶登錄


Step1:配置時鍾同步
 
[root@openldap ~]# yum install -y ntpdate
[root@openldap ~]# systemctl enable ntpdate
[root@openldap ~]# systemctl start ntpdate
[root@openldap ~]# timedatectl set-local-rtc 1
[root@openldap ~]# timedatectl set-timezone Asia/Shanghai
[root@openldap ~]# ntpdate -u  pool.ntp.org
[root@openldap ~]# echo "*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1" >>/var/spool/cron/root
[root@openldap ~]# systemctl reload crond
 
Step2:安裝客戶端必要軟件
 
[root@CentOS7 ~]# yum -y install vim bash-completion openldap-servers openldap-clients nss-pam-ldapd sssd
 
Step3:配置openldap登錄
 
[root@CentOS7 ~]# authconfig-tui
 
 
指定ldap服務器信息
 
 
[root@CentOS7 ~]#  getent passwd                            //獲取ldap賬號
[root@CentOS7 ~]# systemctl enable nslcd  
[root@CentOS7 ~]# systemctl start nslcd  
[root@CentOS7 ~]# cp /etc/nsswitch.conf /etc/nsswitch.conf.old
[root@CentOS7 ~]# sed -i '/^passwd:.*$/s//&  ldap/g' /etc/nsswitch.conf
[root@CentOS7 ~]# sed -i '/^shadow:.*$/s//&  ldap/g' /etc/nsswitch.conf
[root@CentOS7 ~]# sed -i '/^group:.*$/s//&  ldap/g' /etc/nsswitch.conf
[root@CentOS7 ~]# vim  /etc/openldap/ldap.conf
 
 
BASE dc=checkpoint,dc=com
ssl  off
 
 
[root@CentOS7 ~]# nslcd -d            
[root@CentOS7 ~]# yum install autofs -y
[root@CentOS7 ~]# vim /etc/auto.master
 
/net    -hosts
/home/zhangsan     /etc/auto.ldap                  //增加
[root@CentOS7 ~]# vim /etc/auto.ldap
 
zhangsan  10.133.1.200:/home/zhangsan 
 
[root@CentOS7 ~]# systemctl enable autofs.service
[root@CentOS7 ~]# systemctl start autofs.service
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM