Computer technology: 10 ways to generate random passwords using Linux system

  

Usually, everyone generates passwords that are confusing. If the complexity is not enough, it will be insecure. The complexity is enough, and you can't manually type the keyboard and type the same characters. (But usually these characters are regular), using 1password or keepass software generation is also OK, but it seems that 1password is charged, so let's play fun linux to generate random passwords to play;

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

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

  1. date +%s | Sha256sum | Base64 | Head -c 32 ;echo

    The result is as follows:

    1. ZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4

      2. Use embedded /dev/Urandom, and filter out characters that are not used everyday. Only the first 32 characters of the result are output here:

      1. < /dev/urandom tr -dc _A-Z-a-z-0-9 | Head -c${1:-32};echo

        The result is as follows:

        1. pDj0Xwz7exD_Qb5B27BwWsM1hrF3a7cJ

          3. Use Openssl's random function

          1. openssl rand -base64 32

            The result is as follows:

            1. rYJWqJlTLAYeX3j7nCbir20h1k/0CnqLNEuNyTScfKo=

              4. This method is similar to the previous urandom, but it works backwards

              1. tr -cd '[:alnum:]' < ; /dev/urandom |  Fold -w32 |  Head -n1;echo

                The result is as follows:

                1. tpgudzF7sqtU4yyW2LVhmUQOZIQi87

                  5. Using the string command, it takes a file from Output printable string

                  1. strings /dev/urandom |  Grep -o '[[:alnum:]]' |  Head -n 32 |  Tr -d '\ '; echo

                    The result is as follows:

                    1. W4v1iQtkmQ8sIDd9jxDQNpg8HPMOZ8

                      6. This is using urandom A simpler version

                      1. < /dev/urandom tr -dc _A-Zaz-0-9 |  Head -c32;echo

                        The result is as follows:

                        1. rMDlGSPN_bm-IZVFWz9BEi0rF-jIy6gs

                          7. Very useful Dd command

                          1. dd if=/dev/urandom bs=1 count=32 2>/dev/null |  Base64 -w 0 |  Rev |  Cut -b 2- |  Rev

                            The result is as follows:

                            1. 9+0RUd4U3HmSdMlgD7j0sf/r09MZFDVBS28W+pO2WcA

                              8. You can even generate one Password that can be entered with the left hand

                              1. </dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvZZXCVB' |  Head -c32; echo

                                The result is as follows:

                                1. VTG3#TR4sAgXg3Z%##WZG4ZQ@GZ$wdqF

                                  9. If you use one of the above methods each time, a better way is to save it as a function. If you do this, you can generate a random password using randpw at any time after running the command for the first time. Maybe you can save it to your ~/.bashrc file

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

                                    The result is as follows:

                                    1. vgBX8cNo950RiykZRpPYa4BvbAvZbY_x

                                      10 Finally, this method of generating random passwords is the simplest. It can also be run under Windows with Cygwin installed. It can also be run under Mac OS X. I'm sure someone will complain that the password generated by this method has no other way to randomize it. But in fact, if you use all the strings generated by it as passwords, then the password is random enough

                                      1. date |  Md5sum

                                        The result is as follows:

                                        1. e0d057b46a9a78346cbd94b25e574e79 -

                                           
                                          1. date |  base64

                                            generate the following results:
                                             
                                            1. MjAxNOW5tCAwN + aciCAzMeaXpSDmmJ /mnJ /lm5sgMTc6MDA6MzYgQ1NUCg ==

                                               
                                              1. ifconfig |  md5sum

                                                generates the following results:

                                                 
                                                1. 7c4243742aa515d45c12deca31428a95 -


                                                  Even if you want to generate a nuclear launch The password is OK, here is an example of generating a long password;

                                                   
                                                  1. ifconfig |  base64

                                                    to generate the following results:

                                                     
                                                    1. ZW0xICAgICAgIExpbmsgZW5jYXA6RXRoZXJuZXQgIEhXYWRkciA3ODoyQjpDQjoyQjpCMDo5NCAg
                                                    2. CiAgICAgICAgICBpbmV0IGFkZHI6MTkyLjE2OC4zLjUgIEJjYXN0OjE5Mi4xNjguMy4yNTUgIE1h
                                                    3. c2s6MjU1LjI1NS4yNTUuMAogICAgICAgICAgaW5ldDYgYWRkcjogZmU4MDo6N2EyYjpjYmZmOmZl
                                                    4. MmI6YjA5NC82NCBTY29wZTpMaW5rCiAgICAgICAgICBVUCBCUk9BRENBU1QgUlVOTklORyBNVUxU
                                                    5. SUNBU1QgIE1UVToxNTAwICBNZXRyaWM6MQogICAgICAgICAgUlggcGFja2V0czoyMDY3NTY0IGVy
                                                    6. cm9yczowIGRyb3BwZWQ6MCBvdmVycnVuczowIGZyYW1lOjAKICAgICAgICAgIFRYIHBhY2tldHM6
                                                    7. ODg2NDUgZXJyb3JzOjAgZHJvcHBlZDowIG92ZXJydW5zOjAgY2FycmllcjowCiAgICAgICAgICBj
                                                    8. b2xsaXNpb25zOjAgdHhxdWV1ZWxlbjoxMDAwIAogICAgICAgICAgUlggYnl0ZXM6MjAzNDkzNTEx
                                                    9. ICgxOTQuMCBNaUIpICBUWCBieXRlczozMjUyNzUxNiAoMzEuMCBNaUIpCgpsbyAgICAgICAgTGlu
                                                    10. ayBlbmNhcDpMb2NhbCBMb29wYmFjayAgCiAgICA gICAgICBpbmV0IGFkZHI6MTI3LjAuMC4xICBN
Copyright © Windows knowledge All Rights Reserved