117.2. NIS から IdM へのユーザーエントリーの移行
NIS の passwd
マップには、名前、UID、プライマリーグループ、GECOS、シェル、ホームディレクトリーなどのユーザーに関する情報が含まれます。このデータを使用して、NIS ユーザーアカウントを Identity Management (IdM) に移行します。
前提条件
- NIS サーバーの root アクセス権限がある。
- IdM で NIS が有効になっている。
- NIS サーバーが IdM に登録されている。
手順
yp-tools
パッケージをインストールします。[root@nis-server ~]# yum install yp-tools -y
NIS サーバーで、以下の内容を含む
/root/nis-users.sh
スクリプトを作成します。#!/bin/sh # $1 is the NIS domain, $2 is the primary NIS server ypcat -d $1 -h $2 passwd > /dev/shm/nis-map.passwd 2>&1 IFS=$'\n' for line in $(cat /dev/shm/nis-map.passwd) ; do IFS=' ' username=$(echo $line | cut -f1 -d:) # Not collecting encrypted password because we need cleartext password # to create kerberos key uid=$(echo $line | cut -f3 -d:) gid=$(echo $line | cut -f4 -d:) gecos=$(echo $line | cut -f5 -d:) homedir=$(echo $line | cut -f6 -d:) shell=$(echo $line | cut -f7 -d:) # Now create this entry echo passw0rd1 | ipa user-add $username --first=NIS --last=USER \ --password --gidnumber=$gid --uid=$uid --gecos="$gecos" --homedir=$homedir \ --shell=$shell ipa user-show $username done
IdM
admin
ユーザーとして認証します。[root@nis-server ~]# kinit admin
スクリプトを実行します。以下に例を示します。
[root@nis-server ~]# sh /root/nis-users.sh nisdomain nis-server.example.com
重要このスクリプトは、名、姓にハードコードされた値を使用し、パスワードを
passw0rd1
に設定します。ユーザーは、次回ログイン時に一時パスワードを変更する必要があります。