Conversion to FreeBSD from Linux
Mark Sergeant
msergeant at snsonline.net
Wed Feb 25 06:30:17 PST 2004
-- Begin perl script --
#!/usr/bin/perl -w
use AcctInfo;
my $acct = new AcctInfo;
my @realusers = $acct->GetNonSystemUsers;
umask(066);
$pwfile = "/tmp/temppasswd";
open(PWFILE, ">$pwfile") || die "Unable to open $pwfile";
foreach $user (@realusers) {
$acct->SetUser($user);
$acct->cache;
$passwd = $acct->GetPassword;
$uid = $acct->GetUid;
$gid = $acct->GetGid;
$realname = $acct->GetRealName;
$homedir = $acct->GetHomeDir;
$shell = $acct->GetShell;
# Get rid of extraneous , used in Solaris gcos field.
($realname,$junk) = 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 at scottah.com spake thusly:
> > I have been searching the net for a simple answer and I will continue to
> > look, but if anyone has a link, please pass it along.
> >
> > 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.
> >
> > Any links will be appreciated!
>
> man pwconv on Linux and Google/BSD[0] for linux password.
>
> ~elh
>
> 0. http://www.google.com/bsd
--
Mark Sergeant <msergeant at snsonline.net>
SNSOnline Technical Services
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-isp/attachments/20040226/41cff662/attachment.bin
More information about the freebsd-isp
mailing list