random generated password
rsmith at xs4all.nl
Tue Aug 30 18:42:11 UTC 2011
On Tue, Aug 30, 2011 at 07:16:00PM +0100, Michael wrote:
> When adding a new user it is possible to assign a random generated
> password. But is it possible to assign a random password for already
> existing users?
> Preferably in a non-interactive and scriptable way. Is it possible with
> the base system tools?
Generating a random password can be done with the openssl in the base system;
openssl rand -base64 9
You'd want to pipe the output of this command through tee(1) and save it in a
file. Next you pipe it to a file discriptor leading to a 'pw usermod -h
0'. Something like this:
openssl rand -base64 9 | tee -a newpasswords | pw usermod UID -h 0
where UID is the user-id or name of the user in question.
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110830/9ecd8331/attachment.pgp
More information about the freebsd-questions