How to generate random password in Linux – a curated list.

With the growing internet and the security related issues there is always a contant need for setting a strong password at every stage and place possible

pwgen – generate pronounceable passwords

apt-get install pwgen

 

Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

Options supported by pwgen:
-c or --capitalize
Include at least one capital letter in the password
-A or --no-capitalize
Don't include capital letters in the password
-n or --numerals
Include at least one number in the password
-0 or --no-numerals
Don't include numbers in the password
-y or --symbols
Include at least one special symbol in the password
-s or --secure
Generate completely random passwords
-B or --ambiguous
Don't include ambiguous characters in the password
-h or --help
Print a help message
-H or --sha1=path/to/file[#seed]
Use sha1 hash of given file as a (not so) random generator
-C
Print the generated passwords in columns
-1
Don't print the generated passwords in columns
-v or --no-vowels
Do not use any vowels so as to avoid accidental nasty words

Capture1

OpenSSL based random password

openssl rand -base64 32

 

uRandom based random password

dd if=/dev/urandom bs=1 count=16 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev

Gpw  – program to generate pronounceable passwords

apt-get install gpw

Capture2

 

Using Shuf

echo $(shuf -n4 /usr/share/dict/words | tr -d '\n')

Capture3

Apg — generates several random passwords

sudo apt-get install apg

Capture4

Using Date:

Capture5

Otp – One Time Password

 
sudo apt-get install otp 

Capture6

Makepasswd – generate and/or encrypt passwords

sudo apt-get install makepasswd

Capture7

Using GPG

Capture8

For more information  use man pages of the respective commands.

Leave a Reply

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