1. Use the command "pwgen" to generate any unique password with a length equal to 10 characters. If you have not installed pwgen, you can use Apt or YUM to install and obtain it.
Use yum to install: yum install pwgen
If pwgen is installed here, an error is reported:
No package php-mcrypt available. Error: Nothing to do
The solution is also simple. Update epel.
Yum install epel-release // The yum update package of the extension package // update the yum source
In this case, enter "yum install pwgen" on the terminal to complete the installation.
1. Generate any unique password with a length of 10 characters:
[Root @ joesfriend ~] # Pwgen 10 1nie3Ohy4Eo [root @ joesfriend ~] # Pwgen 10 1ieng9iChao
Generate 10 passwords in one breath, each of which is a random password consisting of 30 characters
[Root @ joesfriend ~] # Pwgen 30 10uj5ahth4uex9eetho4aiwohjohh6Uo has been released using biosieseehi1laegh9meev4eeXohyo
Of course, you can also use the makepasswd command to generate a random password, but this command can customize the length of characters and the number of passwords. (The installation method is the same as that of yum install makepasswd ). [Root @ joesfriend ~] # Makepasswd -- char 20 -- count 7
Generate 7 random passwords, each with a length of 20 characters.
Bytes
2. Use the Crypt function with "salt" to encrypt a password. Add "salt" manually or automatically ". (Encryption salt adds a string to the password before encryption using a single function. It can be used to protect the password)
Before performing the following operations, make sure that you have installed mkpasswd. (To install mkpasswd, you must install the keep Ct module .)
Yum-y install benchmark CT
The following command encrypts a password with "salt. The "Salt" value is automatically generated at random. Therefore, each time you run the following command, different outputs are generated, because it receives the random value of "Salt" each time ".
Mkpasswd xxxx (account name)
Now let's manually define the "salt" value. Each time it produces the same result. Please note that you can enter any value you want to input as the "salt" value
[Root @ joesfriend ~] # Mkpasswd tecmint-s tt (the input result will encrypt "tt" into a random string,
You can set the value at will and get the same result every time .)
EilahlaSho8xi [root @ joesfriend ~] # Mkpasswd tecmint-s ttEilahlaSho8xi
3. Use the aes-256-cbc (Openssl) encryption algorithm and use a password with "Salt" (such as "joe") to encrypt a string (such as "hellow, world ")
[Root @ joesfriend ~] # Echo hellow, world | openssl enc-aes-256-cbc-a-salt-pass: joe
In the above example, the input is passed to openssl through the pipeline command, which uses the aes-256-cbc encryption algorithm and comes with the password (joe) and "Salt ". After that, you will get an encrypted string named. 4. Decryption. (Come on anyway.) [root @ joesfriend ~] # Echo A | openssl enc-aes-256-cbc-a-d-salt-pass: joe result: hellow, world