Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate Random password under Linux

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to generate random passwords under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

One of the features of Linux is that it provides us with a variety of options. One purpose can be solved in many ways.

How to generate random passwords under Linux? I have collected more than 10 methods for you for reference only. If you need it, just mark. For any of the following commands, you can control the length of the output.

# 1

Date +% s | sha256sum | base64 | head-c 32; echo

The above command uses SHA to hash the date, outputting the first 32 bytes.

# 2

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo; 上述命令使用内嵌的/dev/urandom,只输出字符,结果取头32个。 #3 openssl rand -base64 32 上述命令使用系统自带的openssl的随机特点来产生随机密码 #4 tr -cd ‘[:alnum:]‘ < /dev/urandom | fold -w30 | head -n1 #5 strings /dev/urandom | grep -o ‘[[:alnum:]]’ | head -n 30 | tr -d ‘\n’; echo 通过过滤字符命令,输出随机密码 #6 < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6 这个命令比起来比较简单了 #7 dd if=/dev/urandom bs=1 count=32 2>

/ dev/null | base64-w 0 | rev | cut-b 2-| rev

The above command uses the powerful features of the command dd

# 8

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report