passwd files (solved sort of)

Mike Cantrell mikec@autodispatch.com
Thu, 10 Aug 2000 11:15:32 -0700


Hmmm.. I wonder if there are any security implications in doing so. SCO's
shadow file is highly specialized for it's OS not to mention the special
accounts each system has. While it might allow them to log in, etc.., it
might end up giving you a headache in the long run.

I'd restore the original files, copy the shadow and passwd files to /tmp on
the linux box and run this script (I'm bored... very bored). You'll want to
make sure the start_uid variable is what you want. Most SCO system's regular
users start at 200 but you'll probably want to double check.

(depending on where your perl is installed, you may need to change the 1st
line to point to the location of your perl executable)

#!/usr/bin/perl
use strict;

my $passwd = "/tmp/passwd";
my $shadow = "/tmp/shadow";
my $start_uid = 200;

open(PASSWD, $passwd) || die "Can't open $passwd: $!";
open(SHADOW, $shadow) || die "Can't open $shadow: $!";

my @users;
PASSWD: while(<PASSWD>) {
    my @passwd = split(/:/, $_);
    my $user = $passwd[0];
    my $uid = $passwd[2];
    while (<SHADOW>) {
        my @shadow = split(/:/, $_);
        if ($shadow[0] eq $user) {
            my $crypt = $shadow[1];
            push(@users, { user => $user, uid=>$uid, crypt=>$crypt});
            next PASSWD;
        }
    }
}

foreach my $user  (@users) {
    if ($user->{uid} >= $start_uid) {
       print "useradd $user->{user} -p $user->{crypt}\n";
       system("useradd $user->{user} -p $user->{crypt");
    }
}



        }----- Original Message -----
From: "Bill Warner" <wwarner@direct-alliance.com>
To: <plug-discuss@lists.PLUG.phoenix.az.us>
Sent: Thursday, August 10, 2000 9:36 AM
Subject: Re: passwd files (solved sort of)


> unfortantly this wont keep the passwords
>
> but it does seem to work by copying the passwd and shadow
> files over from sco to linux.  i tried copying individual
> lines at first and it didn't work.  Once i decided to try
> copying the entire thing it seems to work.  Strange, ohh
> well.  problem solved
>
> Bill Warner
>
> > Copy the /etc/passwd from the SCO box over to the Linux box in /tmp and
do
> > something like this:
> >
> >
> > for i in `cat /tmp/passwd|cut -d":" -f1`;do useradd $i;done
> >
> >
> > man useradd for more options (such as home dir's, etc)..
> >
> >
> > Regards,
> > Mike Cantrell
> >
> > ----- Original Message -----
> > From: "Bill Warner" <wwarner@direct-alliance.com>
> > To: <plug-discuss@lists.PLUG.phoenix.az.us>
> > Sent: Wednesday, August 09, 2000 2:49 PM
> > Subject: Re: passwd files
> >
> >
> > > I have tried this but it doesnt seem to work.  I can't
> > > really even find any good docs on this I have skimmed through
> > > several howtos that I thought might give a clue.  I am still
> > > doing some testing and rtfming I just really dont want to have
> > > to change passwords for over 300 users by hand.
> > >
> > > Bill Warner
> > >
> > > > I'm gonna say just copy the files :-) we've taken entrioes from
linux to
> > > > solaris to BSD to....and have had no issues, so I'd imagine you
wouldn't
> > > > :-)
> > > >
> > > >
> > > > _______________
> > > > Jonathan Furrer
> > > > jonny@jofu.com
> > > > http://www.jofu.com/
> > > >
> > > > On 10 Aug 2000, Bill Warner wrote:
> > > >
> > > > > I am currently converting a SCO system over to Linux and
> > > > > am wondering if there is a way to keep the password and
> > > > > shadow files without having to recreate over 300 users.
> > > > >
> > > > > Does anyone know of the least painfull way of doing this?
> > > > >
> > > > > Bill Warner
> > > > >
> > > > >
> > > > > ________________________________________________
> > > > > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail
> > doesn't post to the list quickly and you use Netscape to write mail.
> > > > >
> > > > > Plug-discuss mailing list  -
Plug-discuss@lists.PLUG.phoenix.az.us
> > > > > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> > > > >
> > > >
> > > >
> > > > ________________________________________________
> > > > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail
doesn't
> > post to the list quickly and you use Netscape to write mail.
> > > >
> > > > Plug-discuss mailing list  -  Plug-discuss@lists.PLUG.phoenix.az.us
> > > > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> > > >
> > >
> > >
> > > ________________________________________________
> > > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail
doesn't
> > post to the list quickly and you use Netscape to write mail.
> > >
> > > Plug-discuss mailing list  -  Plug-discuss@lists.PLUG.phoenix.az.us
> > > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> >
> > ________________________________________________
> > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't
post to the list quickly and you use Netscape to write mail.
> >
> > Plug-discuss mailing list  -  Plug-discuss@lists.PLUG.phoenix.az.us
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
>
>
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't
post to the list quickly and you use Netscape to write mail.
>
> Plug-discuss mailing list  -  Plug-discuss@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss