generating random passwords

N. Raghavendra raghu at mri.ernet.in
Wed Jun 11 11:40:53 UTC 2008


At 2008-06-11T09:20:30+02:00, Zbigniew Szalbot wrote:

> Is there a utility in FreeBSD that would allow me to generate random
> passwords without actually creating any accounts or modifying
> existing ones? I am looking for something to allow me to generate a
> random string of characters.

One way is to use the rand(1) command which comes with the base system
as a part of OpenSSL:

  [riemann:/usr/home/raghu]% openssl rand -base64 6
  1olqAkXG
  [riemann:/usr/home/raghu]% openssl rand -base64 9
  gO/9nTp5/SYa
  [riemann:/usr/home/raghu]% openssl rand -base64 6
  ib9SrIe2

Base64 encoding transforms every group of 3 octets to 4 encoded
characters, so `openssl rand -base64 3N' produces a string with 4N
encoded characters.  In case it is relevant, the generated strings are
made up of the 62 US-ASCII alphanumerical characters, `+', and `/'.

HTH,
Raghavendra.

-- 
N. Raghavendra <raghu at mri.ernet.in> | http://www.retrotexts.net/
Harish-Chandra Research Institute   | http://www.mri.ernet.in/
See message headers for contact and OpenPGP information.



More information about the freebsd-questions mailing list