|
这个是LDAP认证客户端与自动挂载家目录shell脚本配置,使用“authconfig-tui”图形化配置简单,但是后面需要手动操作,自动写入配置文件还没有研究透彻。以后完善
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| #!/bin/bash
yum install -y nss-pam-ldapd nfs-utils nfs autofs pam_ldap openldap openldap-clients
#showmount -e 172.16.16.22
automaster="/etc/auto.master"
automisc="/etc/auto.misc"
ldaphomedir="/ldapdir/users"
[ -d "$ldaphomedir" ] || mkdir -p "$ldaphomedir"
cat /etc/auto.misc | grep "172.16.16.22" &>/dev/null
if [ $? -eq 0 ]; then
echo
echo '"Autofs 172.16.16.22 is EXIST'
sleep 2
elif [ -f "$automisc" -a -f "$automaster"]; then
sed -i '$a /ldapdir /etc/auto.misc' $automaster
sed -i '$a * 172.16.16.22:/ldapdir/users' $automisc
else
echo "autofs is NOT exist "
fi
/etc/init.d/autofs restart
chkconfig autofs on
head -n 20 <<EOF
######################################################################
#The next step configuration LDAP authentication information #
#Press the "space" key to select "*" #
#First: #
# Use LDAP ----------------------"*" #
# Use MD5 Passwords--------------"*" #
# Use Shadow Passwords-----------"*" #
# Use LDAP Authentication--------"*" #
#Second: #
#BASE dc=zxsoft,dc=com #
#URI ldap://172.16.16.22 #
#you can remember this# #
######################################################################
EOF
echo
read -p "continue Y or N:" select
case $select in
"Y"|"y")
authconfig-tui;;
"N"|"n")
exit 2;;
*)
echo "Input Error" && exit 3 ;;
esac
|
|
|