[afnog] Solaris to FreeBSD Migration

NJIE EFOME Paul efomenjie at camnet.cm
Tue Jul 4 12:46:44 EAT 2006


Hi Joe thanks for the help. It worked ok but is there not a script I can the
use to add all the user from the etc password file or shadow file. Thks in
advance.

Regards,
Paul
----- Original Message ----- 
From: "Joe Abley" <jabley at ca.afilias.info>
To: "NJIE EFOME Paul" <efomenjie at camnet.cm>
Cc: <afnog at afnog.org>
Sent: Friday, June 23, 2006 4:22 PM
Subject: Re: [afnog] Solaris to FreeBSD Migration


>
> On 23-Jun-2006, at 04:21, NJIE EFOME Paul wrote:
>
> >     I have installed FreeBSD and all its services and everything is
> > working fine. Now my mail server was on solaris 2.x. Now I want to
> > migrate all my accounts from the old solaris server to my new BSD
> > server. An idea how to proceed. I have the Passwd, shadow and
> > aliases files in a tmp directory in my BSD server already. How do I
> > covert this files in a FreeBSD format. Any one has a migration tool
> > that I can profit. Tks in advance.
>
> Passwords stored in Solaris' /etc/shadow are DES-encrypted, I think,
> which FreeBSD's master.passwd can also handle. So if I have that
> right, there should be no need to require access to plain text
> passwords.
>
> I don't have a Solaris box handy, but according to some random
> document I found on Sun's web page Solaris' /etc/passwd looks like this:
>
> username:password:uid:gid:gecos:homedir:shell
>
> If "password" is "x", then /etc/shadow is consulted for the second
> field.
>
> FreeBSD's master.passwd looks like this:
>
> username:password:uid:gid:class:change:expire:gecos:homedir:shell
>
> So, FreeBSD has some extra fields that need to be incorporated.
> System accounts used in FreeBSD and Solaris are also different; you
> don't want to copy those across directly. This looks like a job for
> awk, plus some manual editing.
>
> Note that I haven't tested the following (you should, before deciding
> that it works :-).
>
> #!/usr/bin/awk -f
> #
> BEGIN {
>    FS=':';
> }
> #
> /^[a-z0-9]*:/ {
>    if ($2 != "x") password[$1] = $2;
>    uid[$1] = $3;
>    gid[$1] = $4;
>    gecos[$1] = $5;
>    homedir[$1] = $6;
>    shell[$1] = $7;
> }
> #
> END {
>    for (n in uid)
>      print n ":" password[n] ":" uid[n] ":" gid[n] "::0:0:" \
>        gecos[n] ":" homedir[n] ":" shell[n];
> }
>
> If you saved that as conv.awk, mode 755, in a directory which
> contained your Solaris passwd and shadow files named "solaris-passwd"
> and "solaris-shadow" you could do something like
>
>    $ ./conv.sh solaris-passwd solaris-shadow >freebsd-passwd
>    $
>
> The lines in "freebsd-passwd" might well be in a jumbled order. You
> can always sort them using sort (see "man sort" for details).
>
> You would then edit freebsd-passwd to remove the Solaris system
> accounts that you don't want to copy over, and to correct anything
> else that seems to be broken. For example, check that home
> directories and shells are appropriate for the new machine; search
> and replace if not. Check that the uids from Solaris are suitable for
> FreeBSD, too (check they don't clash with system accounts, for example).
>
> The edited "freebsd-passwd" file should then be suitable to
> incorporate into your FreeBSD passwd file, which you can edit (for
> example) using vipw.
>
>
> Joe




More information about the afnog mailing list