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

What are the methods of generating random passwords in Linux system

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "what are the methods of generating random passwords in Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Use the sha algorithm to encrypt the date and output the first 32 characters of the result:

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

The result is as follows:

Ztnimgm0ndi5ogzjmwmxndlhzmjmngm4

two。 Use the embedded / dev/urandom and filter out characters that are rarely used on a daily basis. Here, only the first 32 characters of the result are output:

< /dev/urandom tr -dc _a-z-a-z-0-9 |head -c${1:-32};echo 生成结果如下: pdj0xwz7exd_qb5b27bwwsm1hrf3a7cj 3. 使用openssl的随机函数 openssl rand -base64 32 生成结果如下: ryjwqjltlayex3j7ncbir20h1k/0cnqlneunytscfko= 4. 这种方法类似于之前的urandom,但它是反向工作的 tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1;echo 生成结果如下: tpgudzf7sqtu4yyw2lvhmuqoziqi87 5. 使用string命令,它从一个文件中输出可打印的字符串 strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 32 | tr -d '\n'; echo 生成结果如下: w4v1iqtkmq8sidd9jxdqnpg8hpmoz8 6. 这是使用urandom的一个更简单的版本 < /dev/urandom tr -dc _a-z-a-z-0-9 | head -c32;echo 生成结果如下: rmdlgspn_bm-izvfwz9bei0rf-jiy6gs 7. 使用非常有用的dd命令 dd if=/dev/urandom bs=1 count=32 2>

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

The result is as follows:

9+0rud4u3hmsdmlgd7j0sf/r09mzfdvbs28w+po2wca

8. You can even generate a password that can be entered with only the left hand.

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

Development

Wechat

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

12
Report