随机密码生成---mkpasswd

1、安装mkpasswd
 
# yum install expect
 
2、用mkpasswd命令生成随机密码
参数:
-l  定义密码的长度,默认是9
-d 数字个数,默认是2
-c 小写字符个数,默认是2
-C 大写字符个数,默认是2
-s 特殊字符个数,默认是1
 
#man mkpasswd

FLAGS
       The -l flag defines the length of the password.  The default is 9.  The following example creates a 20 character
       password.

            mkpasswd -l 20

       The -d flag defines the minimum number of digits that must be in the password.  The default is 2.  The following
       example creates a password with at least 3 digits.

            mkpasswd -d 3

       The -c flag defines the minimum number of lowercase alphabetic characters that must be  in  the  password.   The
       default is 2.

       The  -C  flag  defines  the minimum number of uppercase alphabetic characters that must be in the password.  The
       default is 2.

       The -s flag defines the minimum number of special characters that must be in the password.  The default is 1.
原文地址:https://www.cnblogs.com/qingchen-24K/p/7270465.html