Date: Mon, 11 Nov 1996 16:29:46 -0700 From: Dave Andersen <angio@aros.net> To: Michael Slater <slaterm@tnet.com.au> Cc: freebsd-isp@freebsd.org Subject: Re: Converting linux shadow passwords Message-ID: <199611112329.QAA01390@fluffy.aros.net> In-Reply-To: Your message of "Mon, 11 Nov 1996 09:56:09 %2B0800." <Pine.LNX.3.91.961111095358.32124A-100000@access.tnet.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> I am in the process of switching from Linux to FreeBSD, and am > wondering if their is a method of Converting the Linux password/shadow > file into a FreeBSD password file, other than manually re-entering every > user ? You have to be set up using DES passwords on your FreeBSD system. There's a FAQ entry that tells you how to do this, I believe. Once you've done that, use a script like this, which will print out the freebsd-style master.passwd file. Don't forget to run pwd_mkdb afterwords. #!/bin/perl # Copyright 1996 David G. Andersen. All rights reserved. No warranty # is expressed or implied for the fitness of this program for any purpose. $shadow = "/etc/shadow"; $passwd = "/etc/passwd"; $output = "npasswd"; umask 077; open(SHADOW, $shadow) || die "Could not open shadow file\n"; while (<SHADOW>) { ($name, $enc) = split(/:/); $PASS{$name} = $enc; } close(SHADOW); open(PASSWD, $passwd) || die "Could not open passwd file\n"; open(OUT, ">$output") || die "Could not open output file\n"; while (<PASSWD>) { chop; ($uname, $blah, $uid, $gid, $gecos, $homedir, $shell) = split(/:/); printf(OUT "%s:%s:%d:%d::0:0:%s:%s:%s\n", $uname, $PASS{$uname}, $uid, $gid, $gecos, $homedir, $shell); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611112329.QAA01390>