SUMMARY: Combining user data from 2 machines to 1

From: <>
Date: Tue Mar 18 2003 - 14:25:03 EST
Thanks to everyone.  I have a lot of info to go threw now.  Below are some of the more detailed answer I got.  



I faced the same situation on HP-UX. To do your job on a minimal sane way you'll have to script this task. I use perl, as it's very flexible and easy to script, better yet than ksh or even bash.

Main issues:

* Same UID's in use on both servers. The simplest approach is to pick an offset and add it to the UID's #s you have on one of the systems you want to consolidate. Make sure you choose an offset to avoid overlaying of UID's. You can apply the same rule for GID's.

* You may have user names (rare) and group names (often) duplicated in both systems. You'll have to create new users with numbers added - for example, if you have jdoe at system #1 and jdoe at system #2, you could create a new username, jdoe2. Remember that your username must have at maximum 8 characters, so if you have mrfoobar in both systems you should change the user name in order to use not plus than 8 characters. You could use mfoobar in one of them. Again, the same rule applies for group names. Don't forget to associate the old users of the duplicated group to the new renamed group.

* /etc/shadow: it's neccesary to make sure that you have no duplicate user names, so it will be the last file to be updated. As soon as you have checked this, just append the list of shadow users of the first computer to the list of shadow users of the second computer. And again, make sure that for every entry that exists in /etc/shadow there is a corresponding user in /etc/passwd.

* MAKE COPIES OF EVERYTHING! You won't want to recreate the passwords of hundreds of users.

try something like

oldhost: cat /etc/passwd | ssh newhost "| /etc/"
newhost: cat >> passwd
groups, shadow ...

the users home directories you can run through an ufsdump to standard out
and restore it at the new host from standard in, eg:

#  ufsdump 0f - /dev/rdsk/c0t0d0s3 | (rsh ...; cd /home; ufsrestore xf -)
'dont forget an .rhost'
This is similar to establishing an NFS user volume to share: you need to resolve the uid/gid problem, so that the same users have the same uid/gid on each of the separate systems, then they can be merged with minimal problems.

1) On each system that needs uids/gids changed: 
   go to single user mode or disable telnet/ftp/ssh for the duration of this exercise:  for each user to be changed: 
        find / -user <olduid> -exec chown <newuid> {} \; 
        find / -group <oldgid> -exec chgrp <newgid> {} \; 
   edit /etc/passwd/change olduid(s) to newuid(s) and oldgid(s) to newgid(s).  /etc/shadow uses userids, does not need to change unless you have a conflict (i.e., two different users but same userid.

2) Enable logins: the only users who will see anything different are ones whose userids changed. 
3) When ready to combine home directories, if any users have accounts on both machines, they will need to make sure that any folders or files in their respective home directories don't collide.  You may want to move the files to separate folders on the combined store, as the startup profiles and rc scripts may not be the same for the new machine, so you have:

        ls -aF /home/<userid> 
where <machine1> and <machine2> contain all the files from their respective sources.  Not a bad idea for people with accounts on only one machine: they can move their folders and visible files up to the $HOME directory but keep the new hidden files and merge them by hand.  This is especially important where you are changing operating environments. 

Once you have all the user account uids/gids fixed, you can use cpio or tar to move the data across the network or onto an NFS mount: Example moving from old machine #1:

        cd /home/<userid> ; find . -print | cpio -pmdu /<nfsmounted_new_home>/<userid/<machine1> 
for NFS or 
        cd /home/<userid> ; tar -cf - . | ssh new_machine '( cd /home/<userid>/<machine1> ; tar -xf - )' 
for network transfer (SSH is relatively slow, but it works). 

SolarisSys wrote:

>I am trying to find out if it is possible to merge two different systems into one due to server consolidation from an older machine to a new machine that is connected to an EMC Symmetric.  My main obstacle is how to combine users home directories, /etc/passwd, /etc/shadow, /etc/group.  Basically how to get the user data over.  Has anyone ever combined two systems to one and jumped the user data obstacle.  Any help would be greatly appreciated
>Try AOL and get 1045 hours FREE for 45 days!
>Get AOL Instant Messenger 5.1 for FREE! Download Now!

Try AOL and get 1045 hours FREE for 45 days!

Get AOL Instant Messenger 5.1 for FREE! Download Now!
sunmanagers mailing list
Received on Tue Mar 18 14:28:58 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:06 EST