Tuesday, May 14, 2013

Linux/Unix Secure Password Generator

Linux provides a build-in functionality to generate secure passwords with a few (piped) commands:
cat /dev/urandom | tr -dc [:print:] | head -c 8
A special file /dev/urandom provides an interface to a Linux kernel random number generator which gathers environmental noise from device drivers and other sources into an entropy pool.

  1. -c 8 parameter controls the length of the password.
  2. [:print:] (complexity) can be substituted with [:alpha:][:digit:] for less complex password.