#! /Bin/bash # Yum install nss-Pam-ldapd pam_ldap openldap-clients-ysed-I "/^ cachecredentials =/d;/^ useshadow =/d; /^ useldapauth =/d;/^ useldap =/d;/^ usecracklib =/d; /^ configure =/D "/etc/sysconfig/authconfigecho" cachecredentials = yesuseshadow = yesuseldapauth = yesuseldap = yesusecracklib = Authorization = yes ">/etc/sysconfig/authconfiggrep 'session optional Authentication SKEL =/etc/skel umask = 0022 '/etc/PAM. d/system-auth | echo 'session optional pam_mkhomedir.so skel =/etc/skel umask = 100'>/etc/PAM. d/system-authgrep 'auth sufficient pam_ldap.so use_first_pass '/etc/PAM. d/system-auth | echo 'auth sufficient Login Failed [default = bad success = OK user_unknown = ignore] login sufficient login use_authtoksession optional pam_ldap.so '>/etc/PAM. d/system-authgrep 'auth sufficient pam_ldap.so use_first_pass '/etc/PAM. d/password-auth | echo 'auth sufficient Login Failed [default = bad success = OK user_unknown = ignore] login sufficient login use_authtoksession optional login skel =/etc/skel umask = 0022 '>/etc/PAM. d/password-authecho 'base Dc = sky, Dc = comuri LDAP: // 172.18.5.105/SSL notls_cacertdir/etc/OpenLDAP/cacertspam_password md5'>/etc/pam_ldap.conf grep 'ldap: // 172.18.5.105/'/etc/nslcd. conf | echo 'uid nslcdgid ldapuri LDAP: // 172.18.5.105/base Dc = sky, Dc = comssl notls_cacertdir/etc/OpenLDAP/cacerts '>/etc/nslcd. confsed-I "s/^ passwd: files $/passwd: Files ldap/g; S/^ shadow: files $/shadow: Files ldap/g; S/^ group: files $/group: Files ldap/g; "/etc/nsswitch. conf echo 'tls _ cacertdir/etc/OpenLDAP/cacertsuri LDAP: // 172.18.5.105base Dc = sky, Dc = com'>/etc/OpenLDAP/ldap. conf chkconfig -- level 35 nslcd on/etc/init. d/nslcd start #### sudo configgrep 'sudoers: LDAP '/etc/nsswitch. conf | echo 'sudoers: LDAP '>/etc/nsswitch. conf echo 'uri LDAP: // 172.18.5.105sudoers _ base ou = sudoers, Dc = sky, Dc = com'>/etc/sudo-ldap.conf
This article from the "Autumn wind song" blog, please be sure to keep this source http://qiufengsong.blog.51cto.com/7520243/1538679