You are not logged in.
Hi,
I've been given task that involves migrating about 40 users from one system to another. The users are not supposed to change their passwords, so the only way to do this is by merging /etc/passwd /etc/group and /etc/shadow from the old with the same files on the new machine.
I'm a bit apprehensive doing this. Anyone here actually done this? If yes, how did you do it exactly?
Any thoughts on this are appreciated.
Ashren
Offline
Never done this before but it should work in theory, why not do this on a test machine or VM and see how it goes?
How's my programming? Call 1-800-DEV-NULL
Offline
zowki: Yes, using a vm is a good idea and I plan to test the procedure on a vm.
Offline
I did something like this years ago. 100 user mail server from red hat 7 to debian. Check that same hash is used on old and new server in shadow, otherwise it should be pretty straighforward to copy user accounts. Just check that UIDs and GIDs dont overlap with anything (shouldn't be a problem..).
Offline
alternative you can just use the BASH
for i in $( cat /old/etc/passwd | cut -d ':' -f 1 ); do useradd -m $i -d /home/$i; done
Last edited by Vamp898 (2010-07-21 20:38:12)
Offline
Also make sure you have the most recent backups of the passwd, shadow and group files on the target system so you can backout quickly if necessary.
All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.
Offline
Thanks for tips guys.
Obi-lan: Thanks for hash tip. I'll keep that in mind if I have to migrate some users from very old systems. UID and GID's will not be a problem in this case I believe.
loafer: Backups are ready if anything happens.
Vamp888: I'll do this one by hand I think, but thanks.
Offline
btw. my skript was not complete. you really have to edit it for example like that
for i in $( cat /old/etc/passwd | cut -d ':' -f 1 ); do
useradd -m $i -d /home/$i
for j in $( cat /old/etc/group | grep $i | cut -d ':' -f 1 ); do
gpasswd -a $i $j
done
done
maybe add some additional lines for the password
Last edited by Vamp898 (2010-07-22 04:15:38)
Offline
Vamp888: It is a fine script, but as I stated in the OP the users shouldn't need to change password, and your script doesn't take heed of UID/GID's. Besides there are scripts to migrate passwd/group/shadow available on the net, but I don't really want to rely on them for this - I think I'll write my own if need be.
Offline