Red Hat Training

A Red Hat training course is available for RHEL 8

112.3. ユーザーグループの NIS から IdM への移行

NIS グループ マップには、グループ名、GID、グループメンバーなどのグループ情報が含まれます。このデータを使用して、NIS グループを Identity Management (IdM) に移行します。

前提条件

手順

  1. yp-tools パッケージをインストールします。

    [root@nis-server ~]# yum install yp-tools -y
  2. 以下の内容を含めて、NIS サーバーに /root/nis-groups.sh スクリプトを作成します。

    #!/bin/sh
    # $1 is the NIS domain, $2 is the primary NIS server
    ypcat -d $1 -h $2 group > /dev/shm/nis-map.group 2>&1
    
    IFS=$'\n'
    for line in $(cat /dev/shm/nis-map.group); do
    	IFS=' '
    	groupname=$(echo $line | cut -f1 -d:)
    	# Not collecting encrypted password because we need cleartext password
    	# to create kerberos key
    	gid=$(echo $line | cut -f3 -d:)
    	members=$(echo $line | cut -f4 -d:)
    
    	# Now create this entry
    	ipa group-add $groupname --desc=NIS_GROUP_$groupname --gid=$gid
    	if [ -n "$members" ]; then
    		ipa group-add-member $groupname --users={$members}
    	fi
    	ipa group-show $groupname
    done
  3. IdM admin ユーザーとして認証します。

    [root@nis-server ~]# kinit admin
  4. スクリプトを実行します。以下に例を示します。

    [root@nis-server ~]# sh /root/nis-groups.sh nisdomain nis-server.example.com