首页 > 系统相关 >linux生成随机密码

linux生成随机密码

时间:2023-02-13 23:13:45浏览次数:36  
标签:src -- wh 密码 随机 dba linux root cloud

##########################

yum -y install pwgen

yum -y install expect

yum -y install openssl

 

 

pwgen生成32位随机密码:大小写字母和数字组成,且无特殊字符

[[email protected] src]# 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
  -r <chars> or --remove-chars=<chars>
    Remove characters from the set of characters to generate passwords
  -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
[[email protected] src]# pwgen -cnsBC   32 1
4CNaYyiaiY4kEkcp4aRAPwyndXfYv9Rj
[[email protected] src]# pwgen -cnsBC   32 4
FozW7gwhcjdYHAckMvCdjCUELyA4nzpF ibzCeXfgK3Xsjg7Ep7izhcXMzhbJWeyX
dgANtpnUxNWXmFdTMugk3WTei4oUh9vP fpEqddbsUaAoVHRFmg4EmWuaujJahzhu
[[email protected] src]# 

 

利用sha256sum和base64生成32位随机密码:只含大小写字母和数字:

[[email protected] src]# date +%s |sha256sum|base64|head -c 32 ;echo
MzQ2MGY1NTAxY2UzMTI2NzY2MjI3MDk5
[[email protected] src]# 

 

 

strings /dev/urandom生成32位随机密码:只含大小写字母和数字:

[[email protected] src]# strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 32 | tr -d '\n'; echo
3jxGc6Izosg58oZznQrJ6qSebY4U6dd1
[[email protected] src]#

 

 

 

 

 

 

 

 

 

 

 

###############################

标签:src,--,wh,密码,随机,dba,linux,root,cloud
From: https://www.cnblogs.com/igoodful/p/17118229.html

相关文章

  • Linux管理文件命令-tail查看文件结尾的内容
    前言    前面有学习了查看文件开头的内容,那么自然就会有查看结尾的内容,这个命令不仅可以作为查看结尾的内容,还可实时查看文件更新的状态等信息,让我们一起来看看这个......
  • 机器学习算法:随机森林
    在经典机器学习中,随机森林一直是一种灵丹妙药类型的模型。该模型很棒有几个原因:与许多其他算法相比,需要较少的数据预处理,因此易于设置充当分类或回归模型不太容易过度......
  • linux008之echo命令显示系统变量和常量
    linux中的系统变量和常量:简介:这里说的变量和常量与windows中的环境变量类似,如在windows中配置的java的环境变量,是这么配置的。java_home:xxxxx/bin,这个时候如果在linu......
  • #yyds干货盘点#如何在 Linux 下删除分区
    有时,您可能希望删除Linux系统上的一些磁盘分区,以恢复或重新获得一些存储空间。只需几个简单的步骤,就可以在命令行上轻松完成这一任务。使用fdisk工具删除一个标准分区fd......
  • linux中软件有哪几种安装方式
    一、绿色安装1.找到相应的安装包,例如apache-tomcat-9.0.zip   上传到linux中的opt目录2.解压安装包  unzip  apache-tomcat-9.0.zip3.进入tomcat目录下的bi......
  • m基于PSO粒子群算法的重采样算法仿真,对比随机重采样,多项式重采样,分层重采样,系统重
    1.算法描述重采样的主要方法有随机重采样,多项式重采样,分层重采样,系统重采样,残差重采样,MSV重采样等。a.随机采样是一种利用分层统计思想设计出来的,将空间均匀划分,粒子......
  • m基于PSO粒子群算法的重采样算法仿真,对比随机重采样,多项式重采样,分层重采样,系统重
    1.算法描述       重采样的主要方法有随机重采样,多项式重采样,分层重采样,系统重采样,残差重采样,MSV重采样等。 a.随机采样是一种利用分层统计思想设计出来的......
  • 【Linux】查看Linux服务器配置概况/CPU/GPU/内存
    ✨配置概况在有GUI界面的Linux服务器可以上直接点击右上角选择Setting>AboutCPU:36核心,主频3.00Ghz,x84_64架构内存:125.5G硬盘:5T✨CPUCPU:36核心,主频3.00Ghz,x84_64......
  • Linux知识点
    Linux虚拟化所需工具:https://pan.baidu.com/s/1643-kYcx9oPGnGEZM1pLOw?pwd=g0v5提取码:g0v5基础包#解决在7的版本中没有ifconfig命令,加上-y不用手动确认yuminstall......
  • linux的安装方式--yum安装
    yum安装 前提 在Linux上安装软件中最头疼的就是软件包之间的依赖关系,通常安装A软件,但是编译的时候会报错说需要B软件,当安装B软件时又报告需要C软件。这个问题rpm安......