首页 > 系统服务 > 详细

Linux生成高强度密码

时间:2017-08-14 01:11:07      阅读:230      评论:0      收藏:0      [点我收藏+]

  在撰写,自动化脚本。往往需要添加账户及密码。如何自动化填写随机密码,有点意思。。。。

01、openssl生成密码

[root@mvp ~]# openssl rand -base 14Usage: rand [options] num
where options are
-out file - write to file
-engine e - use engine e, possibly a hardware device.
-rand file:file:... - seed PRNG from files
-base64 - base64 encode output
-hex - hex encode output

openssl rand -base64 8
openssl rand -hex 3 -out pass.txt --6位

02、使用urandom 生成高强度密码

使用tr 条件来过滤/dev/urandom 的输出,从而删掉那些不想要的字符,并打印出第一个出现的 14位字符
< /dev/urandom tr -dc A-Za-z0-9 | head -c14; echo

< /dev/urandom tr -dc A-Za-z0-9 | head -c6;echo

03、设置快捷命令

vim /etc/bashrc

genpasswd() {
< /dev/urandom tr -dc ‘[:alnum:]‘ | head -c6;echo
}

 

Linux生成高强度密码

原文:http://www.cnblogs.com/xiaochina/p/7329275.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!