118.6.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow yum install yp-tools -y
[root@nis-server ~]# yum install yp-tools -y
Copy to Clipboard Copied! Toggle word wrap Toggle overflow $1 is for the automount entry in ipa $2 is the NIS domain, $3 is the primary NIS server, $4 is the map name $5 is the LDAP server
#!/bin/sh # $1 is for the automount entry in ipa ipa automountlocation-add $1 # $2 is the NIS domain, $3 is the primary NIS server, $4 is the map name ypcat -k -d $2 -h $3 $4 > /dev/shm/nis-map.$4 2>&1 ipa automountmap-add $1 $4 basedn=$(ipa env basedn | tr -d '[:space:]' | cut -f2 -d:) cat > /tmp/amap.ldif <<EOF dn: nis-domain=$2+nis-map=$4,cn=NIS Server,cn=plugins,cn=config objectClass: extensibleObject nis-domain: $2 nis-map: $4 nis-base: automountmapname=$4,cn=$1,cn=automount,$basedn nis-filter: (objectclass=\*) nis-key-format: %{automountKey} nis-value-format: %{automountInformation} EOF # $5 is the LDAP server ldapadd -x -h $5 -D "cn=Directory Manager" -W -f /tmp/amap.ldif IFS=$'\n' for line in $(cat /dev/shm/nis-map.$4); do IFS=" " key=$(echo "$line" | awk '{print $1}') info=$(echo "$line" | sed -e "s^$key[ \t]*") ipa automountkey-add nis $4 --key="$key" --info="$info" done
注記Copy to Clipboard Copied! Toggle word wrap Toggle overflow kinit admin
[root@nis-server ~]# kinit admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow sh /root/nis-automounts.sh location nisdomain
[root@nis-server ~]# sh /root/nis-automounts.sh location nisdomain nis-server.example.com map_name