HOW TO: Random password generator on Ubuntu and other Linux systems
Recently I had need to generate random passwords. I did not want to make a script for it and I certainly did not want any applications to do the tasks. Here is the command line argument for such a task:
</dev/urandom tr -dc A-Za-z0-9_ | head -c8
Note that the ‘tr’ strips out everything except characters in the ranges (alphanumeric, mixed case and underscores). This is a nice approach as piping to head means the minimum number of bytes required to generate a password of appropriate length are taken from /dev/urandom vs other methods which take more than you should need but still have a chance of not having obtained enough random data to generate a password of the required length. You can change the parameter to head to get passwords of any length.
NOTE: I have only run this command on Ubuntu, its possible it works on other Linux systems but I have not checked.
Comment posted by:
Paul Troke
Posted on:
10-09-2011 @ 08:54:41
Really useful bit of code. Thanks very much.


by Soddengecko @ 20:25

The 1 fool before you had this to say about:
“HOW TO: Random password generator on Ubuntu and other Linux systems”