Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 1998 14:44:47 -0600
From:      Graphic Rezidew <rezidew@rezidew.net>
To:        isp@FreeBSD.ORG
Subject:   Re: Moving from Linux to FreeBSD
Message-ID:  <34BE753F.28FFB73E@rezidew.net>
References:  <Pine.BSF.3.96.980115160554.10133A-100000@datorn.teligent.se>

next in thread | previous in thread | raw e-mail | index | archive | help
if you are only concerned with homedirs and passwds then you can do what I
did:

 #1) tar up /home (or where ever you have homedirs)

#2) make a backup of /etc/passwd and /etc/shadow
  NOTE : if you don't have shadow'd passwds then
                  give me an account.

 #3) here is some sample script code to help you do an
        easier passwd conversion. Keep in mind that the
        passwd file from FreeBSD has at least three more
        field than the one from linux (I think one is for
        CLASS)

<!------script>
#!/bin/sh
#
#   crude code .
#   unmaintained shell script to change passwd file from Linux to Freebsd
#   this is provided as is and is not supported by either developement group
#    as neither were involved in my twisted implementations of shell scripts
#
#  Graphic Rezidew
#  Graphic@rezidew.net
#

echo 'what is the name of the passwd file from linux?'
read OLDPASSWD
echo ''
echo 'what is the name of the shadow file from linux?'
read OLDSHADOW

#old method of setting the var's
#OLDPASSWD=/tmp/passwd.linux
#OLDSHADOW=/tmp/shadow.linux

#get the passwd from the shadow file
cat $OLDSHADOW |  cut -d: -f2 > /tmp/shad.2

#get other fields from the passwd file
cat $OLDPASSWD | cut -d: -f1 > /tmp/pass.1

#you don't need field #2 it's the passwd from shad.2
cat $OLDPASSWD | cut -d: -f3 > /tmp/pass.3
cat $OLDPASSWD | cut -d: -f4 > /tmp/pass.4
cat $OLDPASSWD | cut -d: -f5 > /tmp/pass.5
cat $OLDPASSWD | cut -d: -f6 > /tmp/pass.6
cat $OLDPASSWD | cut -d: -f7 > /tmp/pass.7

#put the parts of the files bask together for the new
#passswd file.
cd /tmp
paste -d: pass.1 shad.2 pass.3 pass.4 > /tmp/passwd.new1

#insert the extra 3 fields field for 'CLASS' and that other stuff
# edit this to fit your system (you may not want the default)
cat /tmp/passwd.new1 | sed 's/$/::0:0/' > /tmp/passwd.new2

#resume putting things back together
paste -d: passwd.new2 pass.5 pass.6 pass.7 > /tmp/passwd.new

done
<!------/script>

NOTE: you will have to make sure that  you have the same number of
entries in your passwd and shadow files. If you don't, then you will have to
erase the unused ones from /etc/passwd.

When it's done you can invoke vipw and cut and paste the lines that you want
from
/tmp/passwd.new to the open passwd file in vi.


hope this helps
if you have any questions lemme know.






Jakob Alvermark wrote:

> Hello.
>
> I'm going to upgrade our mail/www-server. It's now running a very old
> version of Linux, and on the new server I want to run FreeBSD. My
> question is if there is an easy way of moving the user accounts from Linux
> to FreeBSD? Can I just copy the password file and home directory? Or is
> there some other way to do this? Any other things I should have in mind
> when doing this?
>
> TIA
>
> /Jakob Alvermark
>
> -------------------------------------------------------
>  Teligent AB, P.O. Box 213, S-149 23 Nynäshamn, Sweden
> Telephone +46-(0)8 520 660 00 * Fax +46-(0)8 520 193 36
>  Direct +46-(0)8 520 660 32 * GSM +46-(0)70 792 16 57



--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
One of the advantages of being a captain is being able to ask for
advice without necessarily having to take it.
                -- Kirk, "Dagger of the Mind", stardate 2715.2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Graphic Rezidew
rezidew@rezidew.net
http://Graphic.Rezidew.net






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34BE753F.28FFB73E>