Summary of the command for randomly generating passwords in Linux, and the command for generating passwords in linux

Source: Internet
Author: User
Tags sha1 sha1 hash

Summary of the command for randomly generating passwords in Linux, and the command for generating passwords in linux

Sometimes it is often difficult to set a secure password that meets the complexity of the password. To tell the truth, this is a physical activity and a waste of time. More importantly, it is often difficult to set a password. Finally, one day I couldn't help it, so I learned and sorted out how to use Linux commands to randomly generate secure and password-compliant commands.

As the saying goes, "to do good deeds, you must first sharpen your tools ". If you can use the dig command, why do you need a hoe? I have been reflecting on myself recently: habitually solving problems in primitive and old ways. It is not good at using some tools to quickly and conveniently solve problems.

1: mkpaswd command

Mkpasswd is a built-in password generation tool in Linux, which is safe and reliable (if you are worried that some online random password generation tools will collect and record your generated password ). I like this tool very much because it can set the complexity of password generation. In addition, it can not only generate a random password for you, but also help you directly change the password of the relevant account. If you cannot find this command, you may not have installed the keep CT package.

Method 1: Install yum.

yum -y install expect

 

 

Method 2: rpm installation.

 
[root@DB-Server Server]# ls *expect*
expect-5.43.0-5.1.i386.rpm  expect-5.43.0-5.1.x86_64.rpm  expect-devel-5.43.0-5.1.i386.rpm  expect-devel-5.43.0-5.1.x86_64.rpm  expectk-5.43.0-5.1.x86_64.rpm  pexpect-2.3-3.el5.noarch.rpm
[root@DB-Server Server]# rpm -ivh expect-5.43.0-5.1.x86_64.rpm
warning: expect-5.43.0-5.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:expect                 ########################################### [100%]

 

Some parameters of the mkpasswd command are as follows:

Parameters

Function Description

-L

Defines the length of the generated password. The default value is 9.

-D

Defines the minimum number of numbers in the password. The default value is 2.

-C

Defines the minimum number of lowercase letters in the password. The default value is 2.

-C

Defines the minimum number of uppercase letters in the password. The default value is 2.

-S

Defines the minimum number of passwords containing special characters. The default value is 1.

-P

Specify another password Generation Program. The default value is/etc/yppasswd.

[root@DB-Server Server]# mkpasswd -l 14 -d 2 -C 2 -s 2 -v kerry
spawn passwd kerry
passwd: Unknown user name 'kerry'.
password for kerry is 1S[(qillErt8xf
[root@DB-Server Server]# mkpasswd -l 14 -d 2 -C 2 -s 2 -v test
spawn passwd test
passwd: Unknown user name 'test'.
password for test is 1ar1t$-qwIHcrb
[root@DB-Server Server]# mkpasswd -l 14 -d 2 -C 2 -s 2 -v oracle
spawn passwd oracle
Changing password for user oracle.
New UNIX password: 
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.
password for oracle is 24_vFkxqsol^pR
[root@DB-Server Server]# 
 
[root@DB-Server Server]# mkpasswd -l 14 -d 2 -C 2 -s 2  oracle
i&jijfgB92*fDa
[root@DB-Server Server]# 

2: apg command

Apg is an open-source free random password generator, official website for http://www.adel.nursat.kz/apg/

Installation Method:

1: apt-get method in Ubuntu:

sudo apt-get install apg

2: RPM:

[root@DB-Server tmp]# rpm -ivh apg-2.2.3-3.el5.rf.i386.rpm 
warning: apg-2.2.3-3.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing...                ########################################### [100%]
   1:apg                    ########################################### [100%]
[root@DB-Server tmp]# 

The parameters of the apg command are as follows:

Parameters

Function Description

-M

Password generation mode

-E

Exclude strings during password generation

-R

Apply dictionary check against file

-B

 

-P

Paranoid modifier for bloom filter check

-

1: Random Password generation mode. 0: generate a customizable Password

-N

Contains numbers, but not every password has

-N

Each password must contain numbers

-M

Minimum length of the generated password. The default value is 8. The length of the actually generated random password may exceed this value.

-X

The maximum length of the generated password.

-S

Contains special characters, but not all of them contain

-S

Each password must contain special characters

-C

Contains uppercase letters.

-C

Each password must contain lowercase letters

-D

No Delimiter is added to the generated password. The six passwords are connected in a long string by default.

-L

Password generation spell

-T

Output the pronunciation of pronunciation characters in the password

-Y

Output encryption Password

-Q

Silent mode, no alarm information output

-H

Output help information

-V

Version information.

[root@DB-Server ~]# 
[root@DB-Server ~]# apg -M SNCL -m 8  -x 12  
Cupif6Swib?
Kij/OvMuk7
cyn=OtDuIf1
eic3Enn>
newCod"Rab4
{Flipnayt0
[root@DB-Server ~]# apg -M SNCL -m 8  -x 12  -t
dujghitt6Ob` (duj-ghitt-SIX-Ob-GRAVE)
RewgEmEc7Ow~ (Rewg-Em-Ec-SEVEN-Ow-TILDE)
Oc%Knegg1 (Oc-PERCENT_SIGN-Knegg-ONE)
loon5Quem+ (loon-FIVE-Quem-PLUS_SIGN)
El5Bleb{ (El-FIVE-Bleb-LEFT_BRACE)
Te4qued( (Te-FOUR-qued-LEFT_PARENTHESIS)

3: pwgen

The password generated by pwgen is easy to remember and secure. Pwgen isHttps://sourceforge.net/projects/pwgen-win/files/PWGen/2.9.0/

Apt-get install pwgen

Some parameters of the pwgen command are described as follows:

Parameters

Function Description

-C

The password contains at least one uppercase letter.

-

The password does not contain uppercase letters.

-N

The password must contain at least one number.

-0

The password does not contain numbers.

-Y

The password must contain at least one special character.

-S

Generate a secure Random Password

-B

The password does not contain obfuscation characters, such as "1" and "I"

-H

View help information

-H

Use sha1 hash to generate the specified file. Random generation is not applicable.

-C

Print the random password generated by Column

-1

One password is output for each row, and the password is not printed in columns.

-V

The password does not include a vowel or a number that may be mistaken for a vowel.

 

root@DB-Server:~# pwgen -h
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
 
root@DB-Server:~# pwgen -C
Xu3aiQuu choo2Aij ohCh3eip ou8ofeeL aYai5thi iet3eeNe ieth1Dei Mairah0o
gad9ooTh faBohZ6e ooJee3Oo Thiec4ah ahb1Iedi Sah7ahth Kainee4o beew7EeW
EedoHa1B eom3Aiph daigee2I AoG4Gei8 Siejoo9o Eemahk6a erur1Aim ohbu6Thi
ae0Ohbai Ehai9go0 ni0iYe4k Ais0eedo Ki3Aiku4 cue7AeXi Ao3lae5o oot2ahTh
yiev2Lei iNgeeth5 aeBi1sai quahh0Ei wei3aeP5 Bohng8ae Eecuor5i kie1eiTh
hiepa7Th uchaiTh5 eiX5Echi reiR4ele RaWaic5l Ahk6fae1 eiD5aen2 saep4Voh
irea6Quo Iakoh7pi eiPhoo1o pie9NeiR aj2Thied Mi3shugh oingi8Oo Vohthoo3
eph6Eed1 Ibooc3ux wo5TaPha Ceigh8aH eeX7ae6r aeB1phoo zohquo9H ahPhaig5
daenu0Ue qui2Feph queT5wo7 fooquo1M Vei4ceej Nie3nae2 IpahLa7e Ku6ahbuf
Oong2ye8 eiJ2haej ohChie4i oowah4Oz utaiM8Sh hah3Oong ieQu1pai aewai8Mi
waip3Aiz Hi0se4ai boon0AZi iR0eicee theeTh5n aeFo4air Tah7teef Aogh3Quo
Iya6eigo ie9Heegh aeyoh9Bo eiXoos4z YeZ7obai doosei4W sapeeBe8 ood1CahC
ie5ohF1s Goonoob2 aiy9Wu7W Oeh3sa5v EiTh9vai iyahs1Fu she5Oogi kohsha7E
Deeleit4 eibie0Th ou4Deihi Pai0oluk Vae6baih Doocee5e ahD2iex3 eil9aiRu
zeiNou0C uu4baiRi ahx2Eew2 Ashai0Ee Yae0aita paph4Air Ich4nei4 Mooph1Ch
eZ0AiTha Hoo8gaeh aiTha3Ga Quaif7ei Iel9oafu Cai0iD2u EeCuL0qu oochae0A
vuk1She4 Bai3Ohte aiChah9v Mohz7iYo zaeyoo8J xah4ohHi ohZ1ohw6 Eed0aeKo
tooQu3ar eiH8rata wiech2UB noMooch6 ahv8Boo3 zea2Gei4 oaM4Eile Cier9ieV
baeReef9 Iom2the0 Foe3ieza zaiNgat4 do1Bah7R ATuyom2u EeQu1lie chaeXo2j
eiza0Aed Leimuol0 eid5yu5C ahp4ahTu OobieSh2 Av8Iaxoh yeid0Eej gooR1aeY
root@DB-Server:~# pwgen -1
au9ni2Fa

Generate a 10-character password containing letters, numbers, and special characters:

root@DB-Server:~# pwgen -1cny 10
 
The9ciep#a

Generate 12 passwords with a length of 10 and contain at least one special character, number, and uppercase letter

root@DB-Server:~# pwgen -cy -1 -n 10 12
cahw]ie7uG
nie1OoKo-u
Anguu4Iu!N
hie%m2ojeH
be7Wo{w:ah
Ee^quaif2u
lo{Ngia1ce
AeToh"D7Ah
ieS5Cho=ch
Lu4seey<aB
Si>oR.aiH6
eo;l6Fie1m

There are also some other password generation tools, such as makepasswd and passwordmaker-cli. I personally think that there are not many tools to master. Just master one or two tools. There are 10 methods for generating random passwords using Linux Command lines on the Internet. Many tools and methods for generating passwords are introduced, but some commands and methods are not practical.

References:

Http://www.geekfan.net/7064/

Http://www.makeuseof.com/tag/5-ways-generate-secure-passwords-linux/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.