LinuxGem
此处为老的 LinuxGem,新版 LinuxGem 请移步 www.linuxgem.org

pwgen -- 帮你生成随机密码

galeki posted @ 2008年3月19日 07:31 in Bash 和它的朋友们 with tags pwgen , 3110 阅读

你的密码够安全吗?

虽然现在使用生日、名字之类的当作密码的人越来越少了,但是如果你的密码是英文单词之类,还是可以通过跑字典破解,而且,现在很多人都有这么一个习惯,就是不管邮箱、IM、论坛帐号什么的,使用的密码都是那么一两个,这样万一一个泄露,全部的帐号都会遭殃……

pwgen 可以帮你生成不容易被破解的“强码”,而且还可以根据你的需求包含符号和大小写,省得你绞尽脑汁去想~

pwgen 的可用参数:

localhost ~ # pwgen --help
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/

什么?太难记了?那是,好记的话还叫随机密码吗……

其实,你完全可以把密码抄在纸上,或者干脆重定向到个文件中去,有报道表明,把密码写在纸上,可以有效防止在不同的地方都使用相同的密码,因此会更安全,只要你妥善保存好就可以,毕竟这比较简单,而且密码多数情况是为了网络上和你相距很远的不速之客。

pwgen 的主页:http://sourceforge.net/projects/pwgen/

  • 无匹配
  • 无匹配
gchuyun 说:
2008年3月19日 16:07 非必要的隐私信息,如银行账户之类的就不用了
shili 说:
2008年3月19日 17:40 可以写在脚本里,给批量的用户创建不同的密码
platinum 说:
2008年3月19日 19:03 可是据说计算机是无法给出真正的随机数的
JSK 说:
2008年3月19日 20:51 @platinum: 那肯定是伪随机数啦。其实通过特别方式还是可以得到真随机数的,看http://www.random.org/
c_cucumber 说:
2008年5月20日 22:13 我用python写过一个随即密码生成器,有兴趣可以去我的blog看

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter