Some of the most secure passwords you can use are those that are randomly generated. From the command line, you can randomize potential passwords in a multitude of ways, which can be used as secure passwords of generated characters.
We’ll cover several primary methods of generating random sequences and then show you how to combine commands to make the generated passwords even more random.
How to Generate Random Passwords via Command Line
First, we’ll try my go-to method that uses openssl:
openssl rand -base64 6
The output of this command will be completely random, and look something like: cG/ah3+9
You can adjust the length of the password by changing the number on the end of the string. If you don’t want to end up with any abnormal characters like / and +, you can generate from hex too:
openssl rand -hex 4
If that isn’t random enough, you can pipe the randomized output of openssl through md5 and trim the md5 hash of the randomized output down to a set number of characters:
openssl rand -base64 8 |md5 |head -c8;echo
You can also get creative and take random input from other commands, such as date, and trim 8 characters from the current dates md5 hash:
date |md5 | head -c8; echo
Or even ping:
ping -c 1 yahoo.com |md5 | head -c8; echo
Using the md5 method, you can take the output of any command, or file, to create a secure password.
Obviously all of these randomized passwords aren’t easy to remember, which is why it can be helpful to use a password manager, but that’s another topic.
“Cutting-Edge Deals, Everyday Prices: Tech Up, Spend Down!”