In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use pwgen to generate passwords under the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The passwords generated by pwgen are easy to remember and fairly secure. Technically, passwords that are easy to remember are no more secure than randomly generated passwords. However, in most cases, the passwords generated by pwgen are secure enough, except for those that require a high level of security, such as online banking passwords. The advantage of using easy-to-remember passwords is that you won't write them down or save them somewhere on your computer, which is inherently unsafe.
Install pwgen and enter in the terminal window (for Debian series Linux systems):
The code is as follows:
Sudo apt-get install pwgen
Running pwgen without any parameters will output a full screen of passwords. You can choose one of them as your password and clear the screen. If you generate a password in this way, even if someone is behind you, he doesn't know which one you chose.
Run pwgen and type in the terminal:
The code is as follows:
Pwgen
After selecting the password, type clear in the terminal to "clear" the contents of the terminal window.
If you are sure there is no one behind it, you can use the "- 1" parameter to have pwgen generate only one password.
The code is as follows:
Pwgen-1
If you want to generate a completely random password, use the "- s" parameter.
The code is as follows:
Pwgen-1-s
If you want to improve the security level of your password, you can use special characters (such as exclamation points, commas, etc.) in your password. Use the "- y" parameter to make the generated password include at least one special character.
The code is as follows:
Pwgen-1-s-y
The pwgen command has more interesting arguments:
-0: the password does not contain numbers.
-B,-- ambiguous: passwords do not contain confusing characters such as "1" and "l", "0" and "O".
-v,-- no-vowels: passwords do not include vowels or may be mistaken for vowels.
Let's look at a few specific examples:
1. Use the command pwgen to generate a unique random password of 10 characters in length.
The code is as follows:
$pwgen 10 1
Generate a unique random password
Generate several unique random passwords with a length of 50 characters in one breath!
The code is as follows:
$pwgen 50
Generate multiple random passwords
two。 You can also use makepasswd to generate a unique random password of a given length at a time. Before you play with the makepasswd command, make sure you have it installed. If you don't have it installed, try using Apt or the YUM package manager to install the makepasswd package.
Generate a random password of 10 characters in length. The length of the password generated by this command defaults to 10.
The code is as follows:
$makepasswd
Use makepasswd to generate unique passwords
Generate a random password of 50 characters in length.
The code is as follows:
$makepasswd-- char 50
Generate a password of length 50
Generate 7 random passwords with a length of 20 characters.
The code is as follows:
$makepasswd-char 20-count 7
3. Use Crypt with salt to encrypt a password. Provide manual or automatic add "salt".
For those who don't know the meaning of salt, the "salt" here refers to a random data that serves as an additional input to the password generation function to protect the password from dictionary attacks.
Make sure that you have installed mkpasswd before performing the following actions.
The following command encrypts a password with "salt". The value of "salt" is randomly generated automatically. So each time you run the following command, it will produce a different output because it accepts a random value of "salt" each time.
The code is as follows:
$mkpasswd tecmint
Use Crypt to encrypt passwords
Now let's manually define the value of "salt". It will produce the same result every time. Please note that you can enter any value you want as the value of "salt".
The code is as follows:
$mkpasswd tecmint-s tt
Encrypted password with "salt"
In addition, mkpasswd is interactive, and if you do not provide a password in the command, it will actively ask you to enter the password.
4. Use the aes-256-cbc encryption algorithm and encrypt a string (such as "Tecmint-is-a-Linux-Community") with a password with "salt" (such as "tecmint").
The code is as follows:
# echo Tecmint-is-a-Linux-Community | openssl enc-aes-256-cbc-a-salt-pass pass:tecmint
Encrypt a string in Linux
In the above example, the output of the echo command is piped to the openssl command so that it is encrypted by encryption encoding (enc:Encoding with Cipher), using the aes-256-cbc encryption algorithm with a password (tecmint) and "salt".
5. Use the-aes-256-cbc decryption option of the openssl command to decrypt the above string.
The code is as follows:
# echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPMINU91DKPeVVrU2k9oXWsgpvpdO/Z | openssl enc-aes-256-cbc-a-d-salt-pass pass:tecmint
This is the end of the content of "how to use pwgen to generate password under Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.