Random Passwords

By: James Andrews
Monday, October 25, 1999 10:37:28 AM EST
URL: http://www.linuxplanet.com/linuxplanet/tips/1141/1/

head -c8 /dev/random | uuencode -m - | sed -n '2s/=*$//;2p'

This prints psuedo "random" characters, for use as a password, for instance. The head command gets 16 bytes from the random device, uuencode flattens out the data to convert control characters into printable ascii and the sed magic at the end just gives a short string with none of the fluff from uuencode.

Copyright Jupitermedia Corp. All Rights Reserved.