人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

詳解Linux下隨機(jī)生成密碼的命令總結(jié)

發(fā)布日期:2022-08-07 12:49 | 文章來(lái)源:腳本之家

有時(shí)候經(jīng)常為如何設(shè)置一個(gè)安全、符合密碼復(fù)雜度的密碼而絞盡腦汁,說(shuō)實(shí)話,這實(shí)在是一個(gè)體力活而且浪費(fèi)時(shí)間,更重要的是設(shè)置密碼的時(shí)候經(jīng)常糾結(jié)。終于有一天實(shí)在忍不住了,于是學(xué)習(xí)、整理了一下如何使用Linux下命令來(lái)隨機(jī)生成安全、符合密碼復(fù)雜度的命令。

俗話說(shuō)“工欲善其事必先利其器”。如果能用挖土機(jī)的,你為什么要用鋤頭? 最近一直在反思自己:習(xí)慣性用原始、老舊的方式解決問(wèn)題。而不擅長(zhǎng)利用一些工具快捷、方便的解決問(wèn)題。

1:mkpaswd命令

mkpasswd 是Linux自帶的一個(gè)密碼生成工具,可以說(shuō)是非常安全、可靠的(如果你擔(dān)心一些在線的隨機(jī)密碼生成工具,會(huì)收集、記錄你生成的密碼的話)。個(gè)人非常喜歡這個(gè)工具的原因就是它可以設(shè)置生成密碼的復(fù)雜度。另外,它不僅可以隨機(jī)幫你生成密碼,還可以直接幫你修改相關(guān)賬號(hào)密碼。如果你找不到這個(gè)命令,那么可能你沒(méi)有安裝expect包。

方式1: yum安裝方式。

yum -y install expect

方式2: rpm安裝方式。

[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%]

關(guān)于mkpasswd命令的一些參數(shù),如下所示:

參數(shù)
功能描述
-l
定義生成密碼的長(zhǎng)度,默認(rèn)9
-d
定義密碼里面包含數(shù)字的最少個(gè)數(shù),默認(rèn)2
-c
定義密碼里面包含小寫(xiě)字母的最少個(gè)數(shù),默認(rèn)2
-C
定義密碼里面包含大寫(xiě)字母的最少個(gè)數(shù),默認(rèn)2
-s
定義密碼密碼包含特殊字符的最少個(gè)數(shù),默認(rèn)1
-p
指定另外一個(gè)生成密碼的程序,默認(rèn)是/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命令

apg是一款開(kāi)源免費(fèi)的密碼隨機(jī)生成器,官方網(wǎng)址為http://www.adel.nursat.kz/apg/

安裝方式:

1:Ubuntu下的apt-get方式:

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]# 

關(guān)于apg命令的一些參數(shù),如下所示:

參數(shù)
功能描述
-M
生成密碼的模式
-E
生成密碼過(guò)程中排除字符串
-r
apply dictionary check against file
-b
-p
paranoid modifier for bloom filter check
-a
1: 隨機(jī)密碼生成模式。 0:可發(fā)音的密碼生成
-n
包含數(shù)字,但是不是每個(gè)密碼都有
-N
每個(gè)密碼都必須包含數(shù)字
-m
生成密碼最小長(zhǎng)度,默認(rèn)為8,實(shí)際生成的隨機(jī)密碼長(zhǎng)度都可能超過(guò)這個(gè)值
-x
生成密碼最大長(zhǎng)度。
-s
包含特殊字符,但是不一定每個(gè)都有
-S
每個(gè)密碼都必須有特殊字符
-c
包含大寫(xiě)字母。
-C
每個(gè)密碼都必須包含小寫(xiě)字母
-d
在生成的密碼中間不加任何分割符,默認(rèn)6個(gè)密碼連成一長(zhǎng)串
-l
生成密碼的spell
-t
輸出密碼中可發(fā)音字符的發(fā)音
-y
輸出加密密碼
-q
靜默模式,不輸出告警信息
-h
輸出幫助信息
-v
版本信息。

[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

pwgen生成的密碼容易記憶而且安全。pwgen的下載地址為https://sourceforge.net/projects/pwgen-win/files/PWGen/2.9.0/

apt-get install pwgen

關(guān)于pwgen命令的一些參數(shù),如下所示:參數(shù)說(shuō)明:

參數(shù)
功能描述
-c
密碼里面包含至少一個(gè)大寫(xiě)字母
-A
密碼里面不包含大寫(xiě)字母
-n
密碼里面至少包含一個(gè)數(shù)字。
-0
密碼中不包含數(shù)字
-y
密碼中至少包含一個(gè)特殊字符。
-s
生成安全隨機(jī)的密碼
-B
密碼中不包含混淆的字符,例如“1”和“I”
-h
查看幫助信息
-H
使用指定文件sha1哈希生成,不適用隨機(jī)生成
-C
按列打印生成的隨機(jī)密碼
-1
每行輸出一個(gè)密碼,不按列打印生成密碼
-v
密碼不包括元音字母或者可能被誤認(rèn)為是元音字母的數(shù)字

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

生成一個(gè)10個(gè)長(zhǎng)度包含大小字母,數(shù)字、特殊字符的密碼:

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

生成12個(gè)密碼長(zhǎng)度為10,并且至少包含一個(gè)特殊字符、數(shù)字、大寫(xiě)字母的密碼

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

當(dāng)然還有一些其它密碼生成工具,例如makepasswd、passwordmaker-cli 。個(gè)人覺(jué)得工具的掌握在精不在多,熟練掌握一兩款工具即可。網(wǎng)上有篇用Linux命令行生成隨機(jī)密碼的十種方法, 里面介紹了很多種生成密碼的工具和方法,只是有些命令和方法非常不實(shí)用。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。

國(guó)外穩(wěn)定服務(wù)器

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問(wèn)服務(wù)

1對(duì)1客戶咨詢顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部