10 ways to generate random passwords using Linux systems

Source: Internet
Author: User
Tags base64 openssl

Usually people generate passwords are confused, one is not enough complexity can be unsafe, enough complexity and can not manually hit the keyboard typing together characters (but usually these characters are regular), using 1password or keepass This software generation can also, But looks like 1password to charge, since so we play a fun to use Linux to generate random passwords to play it;

One of the great advantages of the Linux operating system is that you can use up to hundreds of ways to implement it for the same thing. For example, you can generate random passwords in dozens of ways. This article describes 10 ways to generate a random password.

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

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

生成结果如下:

Ztnimgm0ndi5ogzjmwmxndlhzmjmngm4

2. Use the inline/dev/urandom and filter out characters that are not used everyday . This also outputs only the first 32 characters of the result:

</dev/urandom TR-DC _a-z-a-z-0-9 |head-c${1:-32};echo

生成结果如下:

Pdj0xwz7exd_qb5b27bwwsm1hrf3a7cj

3. Using the random function of OpenSSL

OpenSSL Rand-base64 32

生成结果如下:

ryjwqjltlayex3j7ncbir20h1k/0cnqlneunytscfko=

4. This method is similar to the previous Urandom, but it is reverse-working

TR-CD ' [: alnum:] ' </dev/urandom | Fold-w32 | Head-n1;echo

生成结果如下:

Tpgudzf7sqtu4yyw2lvhmuqoziqi87

5. Use the string command to output a printable string from a file

Strings/dev/urandom | Grep-o ' [[: Alnum:]] ' | Head-n 32 | Tr-d ' \ n '; Echo

生成结果如下:

W4v1iqtkmq8sidd9jxdqnpg8hpmoz8

6. This is a simpler version of using Urandom

</dev/urandom TR-DC _a-z-a-z-0-9 | Head-c32;echo

生成结果如下:

Rmdlgspn_bm-izvfwz9bei0rf-jiy6gs

7. Use the very useful DD command

DD if=/dev/urandom Bs=1 count=32 2>/dev/null | Base64-w 0 | Rev | Cut-b 2-| Rev

生成结果如下:

9+0rud4u3hmsdmlgd7j0sf/r09mzfdvbs28w+po2wca

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

</dev/urandom tr-dc ' [Email protected]#$%qwertqwertasdfgasdfgzxcvbzxcvb ' | HEAD-C32; Echo

生成结果如下:

Vtg3#tr4sagxg3z%##[email protected] $wdqF

9. If one of the above methods is used each time, the better way is to save it as a function. If you do, you can use RANDPW at any time to generate a random password after you run the command for the first time. Maybe you can save it in your ~/.BASHRC file.

RANDPW () {</dev/urandom tr-dc _a-z-a-z-0-9 | Head-c${1:-16};echo;}

生成结果如下:

Vgbx8cno950riykzrppya4bvbavzby_x

10. Finally, this method of generating random passwords is the simplest. It can also run under Windows with Cygwin installed. It can also be run under Mac OS x. I'm sure there will be complaints that this method generates a password that has no other method to be random. But in fact, if you use all the strings that it generates as passwords, that password is random enough.

Date | Md5sum

生成结果如下:

E0d057b46a9a78346cbd94b25e574e79-

Date | base64

生成结果如下:

mjaxnow5tcawn+acicazmeaxpsdmmj/mnj/lm5sgmtc6mda6mzygq1nucg==

ifconfig | md5sum

生成结果如下:

7c4243742aa515d45c12deca31428a95-

甚至你想生成一个核弹发射密码都可以,下面是一个生成长密码的例子;

Ifconfig | Base64

生成结果如下:

Zw0xicagicagiexpbmsgzw5jyxa6rxrozxjuzxqgiehxywrkcia3odoyqjpdqjoyqjpcmdo5ncag
ciagicagicagicbpbmv0igfkzhi6mtkylje2oc4zljugiejjyxn0oje5mi4xnjgumy4yntugie1h
C2s6mju1lji1ns4yntuumaogicagicagicagaw5lddygywrkcjogzmu4mdo6n2eyyjpjymzmomzl
Mmi6yja5nc82ncbty29wztpmaw5rciagicagicagicbvucbcuk9brenbu1qgulvotklorybnvuxu
Sunbu1qgie1uvtoxntawicbnzxryawm6mqogicagicagicagulggcgfja2v0czoymdy3nty0igvy
Cm9yczowigryb3bwzwq6mcbvdmvycnvuczowigzyyw1lojakicagicagicagifryihbhy2tldhm6
Odg2ndugzxjyb3jzojagzhjvchblzdowig92zxjydw5zojagy2fycmllcjowciagicagicagicbj
B2xsaxnpb25zojagdhhxdwv1zwxlbjoxmdawiaogicagicagicagulggynl0zxm6mjazndkzntex
Icgxotqumcbnauipicbuwcbiexrlczozmjuynzuxniaomzeumcbnauipcgpsbyagicagicagtglu
Ayblbmnhcdpmb2nhbcbmb29wymfjayagciagicagicagicbpbmv0igfkzhi6mti3ljaumc4xicbn
Yxnroji1ns4wljaumaogicagicagicagaw5lddygywrkcjogojoxlzeyocbty29wztpib3n0ciag
Icagicagicbvucbmt09qqkfdsybsvu5osu5hicbnvfu6mty0mzygie1ldhjpyzoxciagicagicag
Icbswcbwywnrzxrzoju2otkzmsblcnjvcnm6mcbkcm9wcgvkojagb3zlcnj1bnm6mcbmcmftztow
Ciagicagicagicbuwcbwywnrzxrzoju2otkzmsblcnjvcnm6mcbkcm9wcgvkojagb3zlcnj1bnm6
Mcbjyxjyawvyojakicagicagicagignvbgxpc2lvbnm6mcb0ehf1zxvlbgvuojagciagicagicag
Icbswcbiexrlczozmzezmdcxosaomzeunsbnauipicbuwcbiexrlczozmzezmdcxosaomzeunsbn
auipcgo=

10 ways to generate random passwords using Linux systems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.