Posted: . At: 9:02 AM. This was 10 months ago. Post ID: 16965. Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

How to generate a very secure password very quickly.

The Linux command line may be used to generate a very secure password. The example below shows how to generate a random password, reading from /dev/urandom and then ending up with a random string with enough random characters to be a secure enough password for a Linux user.

tr -dc "0-9A-Fa-f" < /dev/urandom | head -c 32 ; echo

This example is even better. Even more special characters to make it even more secure.

(base) jason@jason-Lenovo-H50-55:~$ tr -dc "0-9A-Fa-f^%$#@&*^" < /dev/urandom | head -c 24 ; echo

To generate a password string to paste into the /etc/shadow file, use openssl like this. You should not specify your password on the command line though, (because it is saved in shell history, and even if it’s deleted, it could still reside for some time in the free space of your disk, especially if you’re using a COW filesystem). You should not manually specify your salt at all. You can achieve this by simply using:

(base) jason@jason-Lenovo-H50-55:~$ openssl passwd -6
Verifying - Password: 

(-6 specifies SHA512. Use -5 for SHA256. Avoid -1 for MD5, if possible.) OpenSSL will ask you for your password via stdin twice and generate a random salt for each input. This is a very easy way to create a Linux user password string.

Here is the password string in the /etc/shadow file.


This worked just fine on my Linux server, I added this user and then gave them a password string generated by the openssl utility. This is a very useful tip.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.