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

Re: [cobalt-users] After cmuImport all password lost



> Dear All,
>  
> After a cmuImport to another server , all of the passwords are not working and changing each of them will be very tedious process.Is there any way to get the passwords back ?
>  
> I wrote a small script also but when I run following command:
>  
> sed "s/$new/$old/g" passwd.new > passwd.old (It gives me error sed: Unknown option to 's')
>  
> $new = $1$6xscwVZ6$nnXUC3S8IO.H69piCFMS.1
> $old = $1$wve/vEC7$os/HvuaEn86cE/SMbSYNP1
>  
> What I think the error is due to the characters in the string which is sed is trying to replace ? Any solutions
>  
> Second : I found a script on the cobalt list also but whenever I run that I get the following error:
>  
> Can't locate CMU/Migrate.pm in @INC (@INC contains: /usr/lib/cmu /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 . /usr/lib/cmu) at ./redopassword line 10.
> BEGIN failed--compilation aborted at ./redopassword line 10.
>  
>  
> Any solutions (Cmu is installed on the server ).

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-