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

Re: [cobalt-users] Adduser Script



> It seems the crypt() requires more arguments.
>
> I tried with your crypt('password') and it complained. I seen some
messages
> about adding something like crypt('password', 'CB')

try this, it packs the crypt with something of which that I have no idea,
but got the snippet of code from another of our administrators.

<--snip-->
srand (time ^ $$ ^ unpack ("%L*", `ps -xlwwa -le | gzip -f`));
@range = (qw(. /), '0'..'9','a'..'z','A'..'Z');
$x = int scalar @range;

sub randchar {
        join '', map $range[rand $x], 1..shift||1;
}

sub encrypt {
        my $salt;
        $salt = randchar(2);
        $crypted = crypt $key, $salt;
}


$key = $pass;
$cypted = encrypt;
<--snip-->
then when you call adduser, the -p command will need to take $crypted as
it's input and you should be all set!