Red Hat Training
A Red Hat training course is available for RHEL 8
109.6. NIS から IdM への自動マウントマップの移行
自動マウントマップは、場所 (親エントリー)、関連のキー、およびマップを定義する入れ子および相互関連のエントリーです。NIS 自動マウントマップを Identity Management (IdM) に移行するには、以下を実行します。
前提条件
- NIS サーバーの root アクセス権限がある。
- IdM で NIS が有効になっている。
- NIS サーバーが IdM に登録されている。
手順
yp-tools
パッケージをインストールします。[root@nis-server ~]# yum install yp-tools -y
以下の内容を含めて、NIS サーバーに
/root/nis-automounts.sh
スクリプトを作成します。#!/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 ldapadd -x -h $3 -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
注記このスクリプトでは、NIS 自動マウント情報のエクスポート、自動マウントの場所と関連マップの LDAP データ交換形式 (LDIF) の生成、IdM Directory Server への LDIF ファイルのインポートが行われます。
IdM
admin
ユーザーとして認証します。[root@nis-server ~]# kinit admin
スクリプトを実行します。以下に例を示します。
[root@nis-server ~]# sh /root/nis-automounts.sh location nisdomain nis-server.example.com map_name