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

RE: how to generate initial password

Are you trying to generate MD5 passwords or crypt?

AFAIK, a valid salt for crypt would be 2 characters drawn from
a-z, A-Z, 0-9, ".", "/".  There shouldn't be any "$" signs.


-----Original Message-----
From: Beast [mailto:beast@setuid.com]
Sent: Sunday, June 22, 2003 11:13 PM
To: openldap-software@OpenLDAP.org
Subject: 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