[CentOS] migrating users from linux to centos

Thu Jul 26 08:41:54 UTC 2007
William L. Maltby <CentOS4Bill at triad.rr.com>

On Tue, 2007-07-24 at 14:46 -0400, Barry L. Kline wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> simon wrote:
> > Dear All,
> > 
> > I have been running linux 9 server as a dns and mail server and is workin
> > fine..
> > 
> > i want to install CENTOS 5 with all the latest mail server software and
> > bind as well as all the libraries on another machine whic is already done
> > 
> > also the data is backed up and will be tranferred.
> > 
> > 
> > but i would like to know
> > 
> > i have about existing 100 mail users
> > 
> > how could i tranfer these usernames and passwrd to the new CENtos 5 server ..
> > 
> > if i copy the /etc/passwd from my linux server it gonna overite my centos5
> > /etc/passwd file as there r new users n also new groups create when i
> > installed centos5 n software
> > also i see that the /etc/shadow has only read permisson for root so cant
> > be over written
> > 
> > is there a way i cd possiblly have the existing users with thier password
> > on centos5 so i dont have to ask them for their passwords n create all
> > users again
> > 
> 
> Create copies of /etc/{passwd,shadow,group} from the original system.
> Edit the copies to EXCLUDE existing user/groups.
> Append the remaining entries to the existing file.
> 
> e.g.:
> 
> cp /etc/passwd /etc/passwd.old   # from the old system
> vim passwd.old  (and edit out the existing entries)
> copy passwd.old   to the new system
> cat passwd.old  >> /etc/passwd   (notice the '>>')
> 
> Repeat for group & shadow.

For me: comm -3 <new box pw file> <old box pw file> >/tmp/new_vs_old_pw
provides less work and reduces the chance of missing something, like
"system" UIDs difference that may be needed. Then vim the output and drp
undesired entries and leading tabs.

If you are confident/don't care about "system" entries diffs, you can
add 1 to the parameter to just give all the entries from the "old" box.

> 
> Barry
> <snip sig stuff>

--
Bill