10 ways to generate random passwords using Linux systems

Source: Internet
Author: User
Tags base64

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 generates the following results: 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 generated results as follows: PDJ0XWZ7EXD_QB5B27BWWSM1HRF3A7CJ

3. Using the random function of OpenSSL

The OpenSSL Rand-base64 32 generates the following results: ryjwqjltlayex3j7ncbir20h1k/0cnqlneunytscfko=

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

TR-CD ' [: alnum:] ' </dev/urandom | Fold-w32 | The Head-n1;echo generates the following results: 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 '; The echo generates the following results: W4v1iqtkmq8sidd9jxdqnpg8hpmoz8

6. This is a simpler version of using Urandom

</dev/urandom TR-DC _a-z-a-z-0-9 | The Head-c32;echo generates the following results: 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 generates the following results: 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; The echo generates the following results: 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;} The resulting results are as follows: 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 | The md5sum generates the following results: e0d057b46a9a78346cbd94b25e574e79-
Date | The base64 generates the following results: mjaxnow5tcawn+acicazmeaxpsdmmj/mnj/lm5sgmtc6mda6mzygq1nucg==
Ifconfig | The md5sum generates the following results: 7c4243742aa515d45c12deca31428a95-
Even if you want to generate a nuclear launch code, here is an example of a growth password; ifconfig | base64 generates the following results: Zw0xicagicagiexpbmsgzw5jyxa6rxrozxjuzxqgiehxywrkcia3odoyqjpdqjoyqjpcmdo5ncagciagicagicagicbpbmv0igfkzhi6mtkylje2oc4zljugi Ejjyxn0oje5mi4xnjgumy4yntugie1hc2s6mju1lji1ns4yntuumaogicagicagicagaw5lddygywrkcjogzmu4mdo6n2eyyjpjymzmomzlmmi6yja5nc82nc bty29wztpmaw5rciagicagicagicbvucbcuk9brenbu1qgulvotklorybnvuxusunbu1qgie1uvtoxntawicbnzxryawm6mqogicagicagicagulggcgfja2v 0czoymdy3nty0igvycm9yczowigryb3bwzwq6mcbvdmvycnvuczowigzyyw1lojakicagicagicagifryihbhy2tldhm6odg2ndugzxjyb3jzojagzhjvchbl Zdowig92zxjydw5zojagy2fycmllcjowciagicagicagicbjb2xsaxnpb25zojagdhhxdwv1zwxlbjoxmdawiaogicagicagicagulggynl0zxm6mjazndkzn Texicgxotqumcbnauipicbuwcbiexrlczozmjuynzuxniaomzeumcbnauipcgpsbyagicagicagtgluayblbmnhcdpmb2nhbcbmb29wymfjayagciagicagic Agicbpbmv0igfkzhi6mti3ljaumc4xicbnyxnroji1ns4wljaumaogicagicagicagaw5lddygywrkcjogojoxlzeyocbty29wztpib3n0ciagicagicagicb Vucbmt09qqkfdsybsvu5osu5hicbnvfu6mty0mzygie1ldhjpyzoxciagicagicagicbswcbwywnrzxrzoju2otkzmsblcnjvcnm6mcbkcm9wcgvkojagb3zlcnj1bnm6mcbmcmftztowciagicagicagicbuwcbwywnrzxrzoju2otkzmsblcnjvcnm6mcbkcm9wcgvkojagb3z Lcnj1bnm6mcbjyxjyawvyojakicagicagicagignvbgxpc2lvbnm6mcb0ehf1zxvlbgvuojagciagicagicagicbswcbiexrlczozmzezmdcxosaomzeunsbn auipicbuwcbiexrlczozmzezmdcxosaomzeunsbnauipcgo=


This article is from the "Linnastovaz" blog, make sure to keep this source http://wz102.blog.51cto.com/3588520/1533369

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.