网上找了些资料,生成密码的工具不少,我就使用了其中一个。
本人使用的市centos系统,用的是epel的源,直接yum install pwgen安装这个工具
然后使用:
[root@eric ~]# pwgen -c -n -y -H
pwgen: option requires an argument -- '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
个人总结了下使用的参数
pwgen -c -n -y 8
c
包括1个大写字母
n
包括一个数字
y
包括一个特殊字符
8
8位密码
然后就会
[root@eric ~]# pwgen -c -y -n 8
op[up8Ho Sil|ie3O eiS6pie{ Eix]ee4m ujei_To1 Ma
Oo-y1dei ahjae%B7 Xa9Igi\G sah#Qu7M Pi+ich2h cha^Gae6 Voo
Eo4chu,o fee!g4Oh Ax;i3chu Ahn4on]u ej7Een\a Hie#tee0 he.Jaar2 Ku5phie]
pa%Lai1r ki
Aa\Z9zei ag{ah9Mi Ao"hoo0O aeYi~mo7 Eef6uGh| gie5Aa>n oH\u9phu Bem&ut2a
paeY!o6h cae]G0aC No(voo6x oreP/eh7 rah=Sh9E io}Quei4 ahW/eeF4 OhVoo[h3
Aeg$e0oh Veo#gh6u Ahr\ahv6 Piet'u5w Koz6ia|l Pai5ie`g Mie6on*e zoo5Aeg{
Oom1it&u Ol1nee~G faib7aX+ IeK$een3 ouQu`ei3 Bae{f1ey aa@Ch9wu Dogh4ek-
Beu^b9uu oJ8eer>i xae/C2ut Ga\u1eir ooW1zai> Uish!ie2 Wait$e9e Aegh?ie5
ii$Qu5du uuGh=ai4 Ahha]a5o Aiqu2eo) Cho0eis_ Feep3ed) moo;qu2A bie[th8T
Ahgh=o9d Ees^ohh4 eZ|a9dae pha.M5ao eeP2oh[u Al8Enoh: lae]k4Eu Pi3ohz>e
Ni*em6we Woh%Boo7 Ge\neo7e thai|M2e uwai(k5U uoZei@C3 Ue5Obua< eem{od2G
hee[ze8W kui2Ce_r Om~iy0uo bieB
uu#B5ein ac
aj2ZeeX` uX_u6vax au,N9wae sei8Veo_ gae%z5Ch Na{a2oa3 Ca5icha& Aboi0Oo\
lae4Tab_ Io'Ngee3 Do`w4aiR aeku.g7A Ook}ing6 ju4re|iX Ia^M0ohy Aing?ei3
xei=l4Ee oo9eM#o7 eeD$aih0 ait&eeX6 ieN"iah5 om0boh/W bi,i4Thi AeS]ae3g
tu|goF5j joo2Ve{b Aec)ael9 tee{Sh6i ieG'ai0u Yi1oa|ci ko@D7iw1 re^x1EeS
Zu-e3eSh ohV}ah7U go9ahPh; nei)Qu9A goo+Y3pe Pu{shec5 Ahr`eeD2 coo7Ais-
ath.oo6B aiMee
如果只要一个加个 -1 参数
=========================================================================
makepasswd 也是差不多的
[root@eric ~]# makepasswd
+xG=0&
[root@eric ~]# makepasswd --help
makepasswd: invalid option -- '-'
Usage: makepasswd [-ceilMmnpSs]
makepasswd -E [-ceilMmnSs]
-c String of allowed characters (A-Za-z0-9`~!@#$%^&*()-_=+)
-E Enumerate all possible values
-e Encryption algorithm (none,base64,blowfish,des,md5,sha1,sha256,shmd5)
-i Number of iterations in encryption algorithm
-l Password length
-M Maximum password length
-m Minimum password length
-n Number of passwords to generate
-p Password to use
-S Do not seed ourselves
-s Salt to use
个人总结了下使用参数有:
[root@eric ~]# makepasswd -l 8 -n 5
a)*@)npP
k(6+LTs=
Rw3Fh=FC
`q$8^MDG
rvz$i)vh
-l
密码长度
-n
生成密码总数
还可以加 -e 参数来生成加密密码哦。
[root@eric ~]# makepasswd -e md5
(tqzrzpQ 5314e68d6a5c8abddc09551a7f1b3f8d
加密类型帮助上有,我就不一个一个的贴了。