4.3. Migrating user group from NIS to IdM
The NIS group map contains information about groups, such as group names, GIDs, or group members. Use this data to migrate NIS groups to Identity Management (IdM):
Prerequisites
- You have root access on NIS server.
- NIS is enabled in IdM.
- The NIS server is enrolled into IdM.
Procedure
Install the
yp-toolspackage:[root@nis-server ~]# dnf install yp-tools -yCreate the
/root/nis-groups.shscript with the following content on the NIS server:#!/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 useropts=$(eval echo --users={$members}) ipa group-add-member $groupname $useropts fi ipa group-show $groupname done注意Make sure your usernames do not contain any special characters to ensure successful migration of the user group.
Authenticate as the IdM
adminuser:[root@nis-server ~]# kinit adminRun the script. For example:
[root@nis-server ~]# sh /root/nis-groups.sh nisdomain nis-server.example.com