Subject: Re: =?ISO-8859-1?Q?user_password?=
To: Zafer Aydogan <zafer@gmx.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 08/09/2005 21:30:08
On Wed, 10 Aug 2005, Zafer Aydogan wrote:

> I'm writing a shell skript to add a new user to the system.
> I have the username and the the password in Variables.
> I can create a user with "useradd", but can't supply the password.

Use the -p switch. See useradd(8) manual page:

     -p password
            specifies an already-encrypted password for the new user.  This
            password can then be changed by using the chpass(1) utility.

Maybe use /usr/libexec/makekey or perl to create a password. Or use 
pkgsrc/security/apg or maybe pkgsrc/security/p5-Crypt-RandPasswd.

Does anyone know if we have a tool that allows you to choose the cipher 
type (like md5, blowfish, des) and other attributes (like rounds or salt) 
to create hashes (from stdin or command line)? Maybe openssl(1) could be 
used to create hashes that are compatible with crypt(3)?

> How do I set the password ? (not interactively)
> chpass is missing option -p for password.

  Jeremy C. Reed

  	  	 	 BSD News, BSD tutorials, BSD links
 	  	 	 http://www.bsdnewsletter.com/