Linux之密码生成工具pwgen

linux中生成随机字符串,可以使用pwgen

安装)

ubuntu:
apt-get install pwgen


Centos:
yum install pwgen

语法及参数)

pwgen [ OPTION ] [ pw_length ] [ num_pw ]
参数:
-c or –capitalize
密码中至少包含一个大写字母

-A or –no-capitalize
密码中不包含大写字母

-n or –numerals
密码中至少包含一个数字

-0 or –no-numerals
密码中不包含数字

-y or –symbols
密码中至少包含一个特殊符号

-s or –secure
生成完全随机密码

-B or –ambiguous
密码中不包含歧义字符(例如1,l,O,0)

-H or –sha1=path/to/file[#seed]
使用SHA1 hash给定的文件作为一个随机种子

-C
在列中打印生成的密码

-1
不要在列中打印生成的密码,即一行一个密码

-v or –no-vowels
不要使用任何元音,以避免偶然的脏话

  

例子:

1.生成长度8,包含数字和大小写字母的密码

pwgen  -ncC 8

2.生成长度8,包含数字和小写字母, 单不包含歧义的字符串

pwgen -nABC 8

3.长度16,包含数字和大小写字母,特殊字符

pwgen -ncy1 16

4.生成一个长度为96的随机字符串

pwgen -N 1 -s 96
原文地址:https://www.cnblogs.com/xingxia/p/linux_pwgen.html