Subject: Re: creating a user - password problem?
To: Bernd Limbach <BeLi@aventa.de>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 03/13/2001 17:27:50
On Wed, 14 Mar 2001, Bernd Limbach wrote:
> I actually solved the problem by using "vipw" and deleting the 13 stars for
> "user_name", then I was able to login and change the password. After that it
> was fine. Anyway, I think this is _not_ the real way to do...
The standard way is to add the user without using the "-p" switch and
without setting the (encrypted) password in /etc/usermgmt.conf. Or use
the /etc/usermgmt.conf password setting if you want to have some generic
(or temporary) defined password.
After the user is created, use the "passwd" command to set the password.
> > For example, if your new users' password is "<do_not_tell_you>" then maybe
> > you could use "RKcHgui/G5H6s".
>
>
> This looks like magic! ;-)
>
> Well, I guess (one more time), that "RKcHgui/G5H6s" is the DES encrypted
> "<do_not_tell_you>". Is that correct?
Yes.
> If yes: how did you encrypt it?
#!/usr/bin/perl
# pop_passwd username password >> password file
$name = $ARGV[0];
@salt_chars = ('a'..'z','A'..'Z','0'..'9');
$salt = $salt_chars[rand(62)] . $salt_chars[rand(62)];
$passwd = crypt ($ARGV[1], $salt);
print "$name:$passwd\n";
Of course, some will argue that this "rand()" is not the best way; but it
works for me.
Jeremy C. Reed - who wonders if anyone can do the DES math in their
head and how long it would take to do on paper.
http://bsd.reedmedia.net/