You are not logged in.

#1 2010-07-16 10:23:42

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Migrating users from an old system to a new - thoughts?

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

#2 2010-07-16 10:39:57

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Migrating users from an old system to a new - thoughts?

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

#3 2010-07-16 10:53:00

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: Migrating users from an old system to a new - thoughts?

zowki: Yes, using a vm is a good idea and I plan to test the procedure on a vm.

Offline

#4 2010-07-21 20:09:35

Obi-Lan
Member
From: Finland
Registered: 2007-05-23
Posts: 179

Re: Migrating users from an old system to a new - thoughts?

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

#5 2010-07-21 20:21:35

Vamp898
Member
From: 東京
Registered: 2009-01-03
Posts: 934
Website

Re: Migrating users from an old system to a new - thoughts?

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

#6 2010-07-21 21:07:43

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: Migrating users from an old system to a new - thoughts?

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

#7 2010-07-21 21:46:57

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: Migrating users from an old system to a new - thoughts?

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

#8 2010-07-22 04:15:13

Vamp898
Member
From: 東京
Registered: 2009-01-03
Posts: 934
Website

Re: Migrating users from an old system to a new - thoughts?

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

#9 2010-07-22 07:48:36

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: Migrating users from an old system to a new - thoughts?

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

Board footer

Powered by FluxBB