Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Generate Strong Passwords From The Terminal  (Read 1664 times)

0 Members and 1 Guest are viewing this topic.

Vineesh K P

  • Guest
How to Generate Strong Passwords From The Terminal
« on: February 17, 2018, 07:57:25 pm »
Having a strong password is the most important thing you can do to protect your account or server and to keep your data secure. Common thinking is that a strong password should be comprised of at least 14 characters, including lowercase and uppercase alphabetic characters, numbers, and symbols and should never be based on a dictionary word. Using a long password is much more secure than using a short one, the longer the password the harder it is to guess. In this post, we will take a look at several different ways to generate a strong password using the Linux command line.

With openssl

This method uses the openssl rand function and it will generate 14 characters random string:

Code: [Select]
openssl rand -base64 14
With urandom

In this method we will filter the /dev/urandom output with tr to delete unwanted characters and print the first 14 characters:
Code: [Select]
< /dev/urandom tr -dc A-Za-z0-9 | head -c14; echo

With gpg


 We can also use the gpg tool to generate a strong 14 characters password:

Code: [Select]
gpg --gen-random --armor 1 14

With strings

Code: [Select]
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 14 | tr -d '\n'; echo