1) 工具说明


 

Linux下的密码生成工具.


 

 

2) 下载安装


 

下载: wget http://fossies.org/unix/privat/pwgen-2.06.tar.gz

安装:

# mkdir -p /orahome/wangnc/pwgen

# cd /orahome/wangnc/pwgen

# rz (上传安装包pwgen-2.06.tar.gz)

# tar zxvf pwgen-2.06.tar.gz && cd pwgen-2.06

# ./configure && make && make install

...

mkdir -p /usr/local/bin /usr/local/man/man1

/usr/bin/install -c pwgen /usr/local/bin/pwgen

/usr/bin/install -c -m 644 ./pwgen.1 /usr/local/man/man1/pwgen.1


 

 

3) 使用示例


 

# which pwgen

/usr/local/bin/pwgen

# pwgen (默认生成一堆8位的密码)

eiju6Ahk EiGh8jee EethaN0e Wah9the0 uNova8Ai WaaRooX0 ooc3DeiC pah0Quai
v

 

# 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

假如你要生成 3 个 10 位的密码,只要 pwgen 10 3 即可:

localhost ~ # pwgen 10 3
oajie9ZaiM tieshi3bah hphae8aech

-s 参数可以生成完全的随机密码,-y 参数可以让你的密码包含 =, ,% 这些符号~

localhost ~ # pwgen -sy 10 3
_\T;6ngPs4 9&5-p3w}|X YLaV^=Q!x/