How to generate a random password?

This blog post discusses how you can generate a random password that you can use for any purpose.

Using the date

If you want to generate a 32 character password that makes use of the date, run that though a base64 hashing algorithm and then display the first 32 characters, you can use the following command.

date +%s | sha256sum | base64 | head -c 32 ; echo

Using urandom

This method used the built-in /dev/urandom feature, and filters out only characters that you would normally use in a password. Then it outputs the top 32.

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;

Using openssl

Use the following command.
openssl rand -base64 32

There are many more ways to do this, and you can follow the source of the article here. Hope this helps!

Previous
Previous

How to create a docker container that persists data?

Next
Next

How to move a PostgresSQL Data Directory?