Scott wrote on Tue, Sep 03, 2002 at 01:10:06PM -0400 :
> #!/usr/bin/perl
> #
> # Simple FreeBSD-to-Linux password converter
> #  -- Linux must be using shadow passwords
> #
> # Nickolai Zeldovich, 1998
> # http://kolya.net/, [EMAIL PROTECTED]
> #
> # Config stuff:
> #
> # "/etc/passwd" on a FreeBSD machine
> $FREEBSD_PASSWD="./freebsd-passwd";
> # "/etc/master.passwd" in a FreeBSD machine
> $FREEBSD_MASTER="./freebsd-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");
> while(<FP>) {
>  chop $_;
>  ($user,$star,$uid,$gid,$gecos,$home,$shell)=split(/\:/);
>  print LP "$user:x:$uid:$gid:$gecos:$home:$shell\n";
>  print LS "$user:$pw{$user}:10000:0:99999:7:::\n";
   `mkdir $home; cp -a /etc/skel/* $home; chown -R $uid:$gid $home`;
> }
> close(FP);
> close(LP);
> close(LS);

Blue skies...                   Todd
-- 
...and I will strike down upon thee with great vengeance and furious
 anger, those who attempt to poison and destroy my binaries, and you 
    will know my name is root, when I lay my vengeance upon thee.

Attachment: msg57506/pgp00000.pgp
Description: PGP signature

Reply via email to