[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: how to generate initial password

Sunday, June 22, 2003, 2:49:44 AM, Steve wrote:

> Wouldn't it need to be:

> print "userPassword: {crypt}$my_passwd\n";

Sorry, it was typo.

Results generated from crypt() is very different from result generated
from passwd command (in /etc/shadow) with same 'salt'.
When I paste password from /etc/shadow it was working

#! /usr/bin/perl
$my_passwd = crypt("abc123",'$1');
print "userPassword: {crypt}$my_passwd\n";

result :
userPassword: {crypt}$1xaBJ0x76dlk

>From /etc/shadow

[root@credo tmp]# passwd
Changing password for user root.
New password: <------ abc123
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

[root@credo tmp]# head -1 /etc/shadow