From owner-freebsd-isp@FreeBSD.ORG Wed Feb 25 06:30:17 2004 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3FCC416A4CE for ; Wed, 25 Feb 2004 06:30:17 -0800 (PST) Received: from xyzzy.wireless.snsonline.net (210-18-214-108.cust.iexec.net.au [210.18.214.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E16743D1D for ; Wed, 25 Feb 2004 06:30:16 -0800 (PST) (envelope-from msergeant@snsonline.net) Received: from xyzzy.wireless.snsonline.net (localhost [127.0.0.1]) i1PEUD8L004117; Thu, 26 Feb 2004 00:30:13 +1000 (EST) (envelope-from msergeant@snsonline.net) Received: (from msergeant@localhost)i1PEUBRP004116; Thu, 26 Feb 2004 00:30:11 +1000 (EST) (envelope-from msergeant@snsonline.net) X-Authentication-Warning: xyzzy.wireless.snsonline.net: msergeant set sender to msergeant@snsonline.net using -f From: Mark Sergeant To: "Eric L. Howard" In-Reply-To: <20040225141355.GA1519@outreachnetworks.com> References: <200402251339.i1PDdc2B011071@cah.talon.net> <20040225141355.GA1519@outreachnetworks.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-wEHfKFCkK6E2tKds8ovl" Organization: SNSOnline Technical Services Message-Id: <1077719411.1351.6.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Thu, 26 Feb 2004 00:30:11 +1000 cc: freebsd-isp@freebsd.org Subject: Re: Conversion to FreeBSD from Linux X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 14:30:17 -0000 --=-wEHfKFCkK6E2tKds8ovl Content-Type: text/plain Content-Transfer-Encoding: quoted-printable -- Begin perl script -- #!/usr/bin/perl -w use AcctInfo; my $acct =3D new AcctInfo; my @realusers =3D $acct->GetNonSystemUsers; umask(066); $pwfile =3D "/tmp/temppasswd"; open(PWFILE, ">$pwfile") || die "Unable to open $pwfile"; foreach $user (@realusers) { $acct->SetUser($user); $acct->cache; $passwd =3D $acct->GetPassword; $uid =3D $acct->GetUid; $gid =3D $acct->GetGid; $realname =3D $acct->GetRealName; $homedir =3D $acct->GetHomeDir; $shell =3D $acct->GetShell; # Get rid of extraneous , used in Solaris gcos field. ($realname,$junk) =3D split(/,/, $realname); # Output data in bsd password format. print PWFILE $user . ":" . $passwd . ":" . $uid . ":" . $gid . "::0:0:" . $realname . ":" . $homedir . ":" . $shell . "\n"; } close(PWFILE); exit; -- End perl script Should work well enough on linux as well. ohh and of course if you intend to use it more than once drop in some error checking / catching, something to remove the system accounts and of course "use strict" Cheers, Mark On Thu, 2004-02-26 at 00:13, Eric L. Howard wrote: > At a certain time, now past [Feb.25.2004-08:43:20AM -0500], ssj@scottah.c= om spake thusly: > > I have been searching the net for a simple answer and I will continue t= o > > look, but if anyone has a link, please pass it along. > >=20 > > Two years ago I converted my BSDi password file to Linux with a simple > > script to replace fields. For obvious reasons I want to move back to > > FreeBSD, but of course I need to convert the Linux passwd file of 2,000= + > > users to FreeBSD. > >=20 > > Any links will be appreciated! >=20 > man pwconv on Linux and Google/BSD[0] for linux password. >=20 > ~elh >=20 > 0. http://www.google.com/bsd --=20 Mark Sergeant SNSOnline Technical Services --=-wEHfKFCkK6E2tKds8ovl Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBAPLFybS4ZEpHb8t0RAoiEAJwO83DUt1ippN9c8rzEWgPV+xqjhgCfagtv PhULxc7+Q5+D73Npv/gdIAE= =HPMp -----END PGP SIGNATURE----- --=-wEHfKFCkK6E2tKds8ovl--