[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Moving from BSDi



At 05:39 PM 10/28/2002 +0100, Russell Coker wrote:
Debian supports both DES and MD5 hashing of passwords.  If the BSD passwords
for your accounts are in one of those formats then it'll be trivial to
convert them.

You could create a test account and set a password, then post the lines from
/etc/passwd and /etc/shadow here and we'll try and devise some sort of
proceedure for you...

I just found a script that may do this and I copied it below. I have considered using
Postfix with MySQL, is there a way to get the accounts into MySQL even though
the passwords are encrypted?

Here is the script:

#!/usr/bin/perl
#
# Simple FreeBSD-to-Linux password converter
#  -- Linux must be using shadow passwords
#
# Nickolai Zeldovich, 1998
# http://kolya.net/, kolya@zepa.net
#
# Config stuff:
#
# "/etc/passwd" on a FreeBSD machine
$FREEBSD_PASSWD="passwd";
# "/etc/master.passwd" in a FreeBSD machine
$FREEBSD_MASTER="./master.passwd";
# Where you want the Linux version of passwd file
$LINUX_PASSWD="./linux-passwd";
# Where you want the Linux version of shadow file
$LINUX_SHADOW="./linux-shadow";
# Go for it..
open(FM,"$FREEBSD_MASTER");
while(<FM>) {
    chop $_;
    ($user,$cryptpw,@etc)= split(/\:/);
    $pw{$user}=$cryptpw;
}
close(FM);
open(FP,"$FREEBSD_PASSWD");
open(LP,">$LINUX_PASSWD");
open(LS,">$LINUX_SHADOW");
$count = 999;
while(<FP>) {
    $count++;
    chop $_;
    ($user,$star,$uid,$gid,$gecos,$home,$shell)=split(/\:/);
    print LP "$user:x:$count:100:$gecos:/home/$user:/bin/bash\n";
    print LS "$user:$pw{$user}:10000:0:99999:7:::\n";
}
close(FP);
close(LP);
close(LS);



Reply to: