Date: Thu, 26 Feb 2004 00:30:11 +1000 From: Mark Sergeant <msergeant@snsonline.net> To: "Eric L. Howard" <elh@outreachnetworks.com> Cc: freebsd-isp@freebsd.org Subject: Re: Conversion to FreeBSD from Linux Message-ID: <1077719411.1351.6.camel@localhost> In-Reply-To: <20040225141355.GA1519@outreachnetworks.com> References: <200402251339.i1PDdc2B011071@cah.talon.net> <20040225141355.GA1519@outreachnetworks.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-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 <msergeant@snsonline.net> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1077719411.1351.6.camel>