Linux generates complex passwords and checks password strength

Time:2022-10-12

In this tutorial, we will discuss how to generate complex passwords and check password strength. Generate complex passwords Strong passwords should consist of a mix of letters, numbers, and symbols. The second requirement is not to use known words, dates of birth or names, as they are vulnerable to dictionary attacks. How many characters should the password contain? There’s really no concrete answer, but more than 16 characters is a good bet. Therefore, if your system has OpenSSL or GPG, you can use these tools to complete the task of generating passwords. For example, below we use GPG to generate passwords: [[email protected] ~]# gpg –gen-random –armor 2 12
zXVKRoB0/V4BN9QG
If you don’t want to have special characters, you can use the sed command to filter out: [[email protected] ~]# gpg –gen-random –armor 2 12|sed ‘s/1//g’
n4ciIlRLkLTkzwg
The above uses the –gen-random option to generate characters randomly. Use the –armor option to generate ASCII characters. The latter option 2 can make 0[2] three options, he indicates the quality level. The last number represents the character length. The same, we can use OpenSSL to generate the cipher: [[email protected] ~]# openssl rand -base64 12
QIrH/PLXqzmLuI/a
Similarly, you can also use the sed command to filter out special characters: [[email protected] ~]# openssl rand -base64 12| sed ‘s/1//g’
lXIg4cKLCLVvsi
Checking Password Strength Now that we have our password, it’s time to see if it passes the test: Is your password strong enough? To determine if the password is strong enough, we will install the cracklib tool in Centos8. [[email protected] ~]# yum -y install cracklib
Let’s test a simple password first:[[email protected] ~]# echo “a1b2c5” | cracklib-check
a1b2c5: it is based on a dictionary word

Linux generates complex passwords and checks password strength
What if you use ordinary words? [[email protected] ~]# echo “Administrator”|cracklib-check
Administrator: it is based on a dictionary word

Linux generates complex passwords and checks password strength
The output of the above two passwords also suggests that they can be found in the dictionary. Let’s test a generated password to see how strong it is: [[email protected] ~]# openssl rand -base64 12 | cracklib-check
VdBlmvIgGY4ehWly: OK
You can see that the password is OK. Summary In this tutorial, we’ve seen how easy it is to generate and verify passwords, but don’t forget to generate different passwords for each service!


  1. a-zA-Z0-9

Recommended Today

mybatis source code notes

Table of contents Open and tear MyBatis source code 1. Handwritten persistence layer framework-ipersistent 1.1 JDBC operation database\_problem analysis 1.2 JDBC problem analysis & solution ideas 1.3 Custom Persistence Layer Framework\_Thinking Analysis The difference between using JDBC and using the persistence layer framework: The framework, in addition to thinking about its own engineering design, also […]