Three methods of generating high strength passwords

Now information disclosure is more and more serious, and a strong password is the first step to prevent the disclosure of personal sensitive information. Liang Xu once shared an article about how to judge whether your password is secure enough. Click the following link to check:

In the era of information disclosure, how to make your password more secure?

In life, we need to use a large number of passwords, which should not be unified, otherwise, in case of leakage, all accounts are exposed to risk. In our work, we also need to use a large number of passwords, such as batch adding users, batch setting server passwords, etc.

If you think about it on your own, the password you think about can not be powerful enough, and it's more laborious. Next, Liang Xu introduces three methods to generate high-strength passwords in batches.

The so-called high-strength password is a password that contains case, number and symbol.

1. pwgen

The characteristic of pwgen is that it can generate some passwords that can be remembered by human beings and are secure enough. However, if you want to generate random passwords that are not easy to remember, just add the - s option.

1.1 pwgen installation

For Debian/Ubuntu systems, use apt get command directly to install.

$ sudo apt install pwgen

For RHEL/CentOS systems, you can use the yum command to install.

$ sudo yum install pwgen

Other systems can use the corresponding installation commands, which will not be described here.

1.2 usage of pwgen

The simplest use of pwgen is to type in the command directly and generate 160 passwords without any parameters. By default, the password it generates is an easy to remember password with 8 characters, including case and number.

There are 160 in total, divided into 20 rows and 8 columns. Limited to space, the following results have been reduced.

$ pwgen
ameiK2oo aibi3Cha EPium0Ie aisoh1Ee Nidee9ae uNga0Bee uPh9ieM1 ahn1ooNg
oc5ooTea tai7eKid tae2yieS hiecaiR8 wohY2Ohk Uab2maed heC4aXoh Ob6Nieso
............
ahV4yore ue2laePh fu1eThui qui7aePh Fahth1nu ohk9puLo aiBeez0b Neengai5

If you want to generate five 14 character passwords, you can use the following command:

$ pwgen -s 14 5
7YxUwDyfxGVTYD em2NT6FceXjPfT u8jlrljbrclcTi IruIX3Xu0TFXRr X8M9cB6wKNot1e

If you want to generate a super hard to remember, super safe password, you can add the - cnys option and use the following format:

$ pwgen -cnys 14 20
mQ3E=vfGfZ,5[B #zmj{i5|ZS){jg Ht_8i7OqJ%N`~2 443fa5iJ\W-L?] ?Qs$o=vz2vgQBR
^'Ry0Az|J9p2+0 t2oA/n7U_'|QRx EsX*%_(4./QCRJ ACr-,8yF9&eM[* !Xz1C'bw?tv50o
8hfv-fK(VxwQGS q!qj?sD7Xmkb7^ N#Zp\_Y2kr%!)~ 4*pwYs{bq]Hh&Y |4u=-Q1!jS~8=;
]{$N#FPX1L2B{h I|01fcK.z?QTz" l~]JD_,W%5bp.E +i2=D3;BQ}p+$I n.a3,.D3VQ3~&i

2. openssl

OpenSSL command is to call all kinds of cryptography functions in some OpenSSL libraries to generate passwords, and its strength is relatively high.

We can use the following command format to generate a 14 bit random password:

$ openssl rand -base64 14
WjzyDqdkWf3e53tJw/c=

However, such a command can only generate one password. If you want to generate passwords in batch, you need to write a simple Shell statement.

$ for pw in {1..4}; do openssl rand -base64 14; done
6i0hgHDBi3ohZ9Mil8I=
gtn+y1bVFJFanpJqWaA=
rYu+wy+0nwLf5lk7TBA=
xrdNGykIzxaKDiLF2Bw=

3. gpg

In 1991, Phil Zimmermann, a programmer, developed the encryption software PGP to avoid government surveillance. This software is very easy to use, spread quickly, and become a necessary tool for many programmers. However, it is commercial software and cannot be used freely. So the free software foundation decided to develop an alternative to PGP called GnuPG.

We can use the following format to generate a random 14 bit high-strength password.

$ gpg --gen-random --armor 1 14
or
$ gpg2 --gen-random --armor 1 14
jq1mtY4gBa6gIuJrggM=

Similarly, if this command can only generate one password, if you want to generate multiple passwords, you need to write a simple Shell statement.

$ for pw in {1..4}; do gpg --gen-random --armor 1 14; done
or
$ for pw in {1..4}; do gpg2 --gen-random --armor 1 14; done
F5ZzLSUMet2kefG6Ssc=
8hh7BFNs8Qu0cnrvHrY=
B+PEt28CosR5xO05/sQ=
m21bfx6UG1cBDzVGKcE=

4. Summary

A strong password is the first step to ensure the security of our account, which is of great importance. This paper introduces three random methods to generate high-strength passwords, but there are many tools to generate such passwords, such as makepasswd, mkpasswd and so on. How do you usually generate passwords? Welcome to leave a message to discuss!

Official account: good Linux

What's the gain? I hope the old fellow will take three strikes to show this article to more people.

Tags: Linux OpenSSL sudo yum shell

Posted on Thu, 04 Jun 2020 09:32:18 -0400 by gamblor01