Lowell Gilbert wrote:

Konrad Heuer <[EMAIL PROTECTED]> writes:


On Thu, 8 Apr 2004, Brian Sheehan wrote:


I've recently done a fresh installation of freebsd 4.9, and now I want
to migrate the user accounts from a redhat 9 machine to the new freebsd
machine, and hopefully keep logins and passwords unchanged. Is this
possible?


It is possible, but you need to write a shell or perl script to combine
the user entries in the Linux files /etc/passwd and /etc/shadow

[...]


There's an awk script in the passwd(5) manual for this purpose.

Hi all,


Thanks to Lowell & Konrad for their help.

I managed migrate the accounts, without a hitch (so far so good anyway). Here is a step by step account of what i did, for future reference:

1) Created an NFS share on the linux machine, which was exported to the freebsd machine with the no_root_squash option. The entry in /etc/exports was:

/home <freebsd_machine>(ro,no_root_squash)

2) Copied the home directories accross with the tar command given by Konrad:

tar cCf /path/to/nfs/mount - . | tar xvpCf /path/to/new/home/dirs -

The following 5 steps where copied from: http://www.openbsd.org/faq/faq9.html#passwd

3) Merged /etc/passwd and /etc/shadow from the linux machine, using unshadow, part of the john the ripper suite - see http://www.openwall.com/john/ (a ports package is available)

unshadow /etc/passwd /etc/shadow > linux_passwd

4) Next, I converted the results to the /etc/master.passwd format using awk:

# cat linux_passwd | awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", \
> $1,$2,$3,$4,$5,$6,$7); }' > new_passwd

5) Now I edited new_passwd, removing any of the system account entries (root, daemon etc) and any of the user accounts that overlapped with user accounts already on the freebsd machine.

6) Merge new_passwd with /etc/master.passwd on the freebsd box
# cat new_passwd >> /etc/master.passwd

7) And then generate the password database files (/etc/spwd.db and /etc/pwd.db), and the normal /etc/passwd file.
# pwd_mkdb -p /etc/master.passwd


8) On both the linux box and the freebsd one, each user has its own group (of the same name of the user). For any users migrated from the linux machine to the bsd one, I also copied the corresponding entries from linux:/etc/group to freebsd:/etc/group. I hadn't seen anyone suggest doing this, but I can't see why it would be problem, and it seems to work fine.

that's it!

thanks again for the help,

Brian
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to