[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] User's Password problem with CmuImport



> Dear Mr. Jeff Bilicki,
>                         This is regarding the user's
> password restoring problem when we do cmuImport. The
> script that you have given requires Migrate.pm module
> which I was not able to find anywhere. Can you please
> guide me how can I restore the user's password with
> your script.

> Your ealry response will be solicted.
> Hope to hear from you soon.

> Thanks.
> Regards.
> Yadavendra Awasthi.

That redopassword script was written for the 1.x series of CMU, here is an
updated one:

#!/usr/bin/perl
# $Id: redoPasswd,v 1.2 2002/02/11 21:53:44 jeffb Exp $
# Goes back through the cmu.xml and pulls out the encypted passwords
# and adds them to /etc/shadow
# ./redoPasswd /location/of/xml/cmu.xml

use strict;

die "You must run this script as root\n" if ($< != 0);

use lib "/usr/cmu/perl";
use TreeXml;
require RaQUtil;

my $cmuFile = $ARGV[0];
unless(-f $cmuFile) {
        print "Cannot find file $cmuFile\n";
        die "usage:     $0 [FILE]\n";
}

my $tree = TreeXml::readXml($cmuFile, 0);
if(! defined $tree->{user}) {
        die "No users defined in $cmuFile\n";
} else {
        RaQUtil::setShadowPass($tree->{user});
        chmod 0400, '/etc/shadow';
}

exit 0;

Jeff-