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:
- date +%s | Sha256sum | Base64 | Head -c 32 ;echo
The result is as follows:
- 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:
- < /dev/urandom tr -dc _A-Z-a-z-0-9 | Head -c${1:-32};echo
The result is as follows:
- pDj0Xwz7exD_Qb5B27BwWsM1hrF3a7cJ
3. Use Openssl's random function
- openssl rand -base64 32
The result is as follows:
- rYJWqJlTLAYeX3j7nCbir20h1k/0CnqLNEuNyTScfKo=
4. This method is similar to the previous urandom, but it works backwards
- tr -cd '[:alnum:]' < ; /dev/urandom | Fold -w32 | Head -n1;echo
The result is as follows:
- tpgudzF7sqtU4yyW2LVhmUQOZIQi87
5. Using the string command, it takes a file from Output printable string
- strings /dev/urandom | Grep -o '[[:alnum:]]' | Head -n 32 | Tr -d '\ '; echo
The result is as follows:
- W4v1iQtkmQ8sIDd9jxDQNpg8HPMOZ8
6. This is using urandom A simpler version
- < /dev/urandom tr -dc _A-Zaz-0-9 | Head -c32;echo
The result is as follows:
- rMDlGSPN_bm-IZVFWz9BEi0rF-jIy6gs
7. Very useful Dd command
- 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 one Password that can be entered with the left hand
- </dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvZZXCVB' | Head -c32; echo
The result is as follows:
- 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
- randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 | Head -c${1:-16};echo;}
The result is as follows:
- 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
- date | Md5sum
The result is as follows:
- e0d057b46a9a78346cbd94b25e574e79 -
- date | base64
generate the following results:
- MjAxNOW5tCAwN + aciCAzMeaXpSDmmJ /mnJ /lm5sgMTc6MDA6MzYgQ1NUCg ==
- ifconfig | md5sum
generates the following results:
- 7c4243742aa515d45c12deca31428a95 -
Even if you want to generate a nuclear launch The password is OK, here is an example of generating a long password;
- ifconfig | base64
to generate the following results:
- ZW0xICAgICAgIExpbmsgZW5jYXA6RXRoZXJuZXQgIEhXYWRkciA3ODoyQjpDQjoyQjpCMDo5NCAg
- CiAgICAgICAgICBpbmV0IGFkZHI6MTkyLjE2OC4zLjUgIEJjYXN0OjE5Mi4xNjguMy4yNTUgIE1h
- c2s6MjU1LjI1NS4yNTUuMAogICAgICAgICAgaW5ldDYgYWRkcjogZmU4MDo6N2EyYjpjYmZmOmZl
- MmI6YjA5NC82NCBTY29wZTpMaW5rCiAgICAgICAgICBVUCBCUk9BRENBU1QgUlVOTklORyBNVUxU
- SUNBU1QgIE1UVToxNTAwICBNZXRyaWM6MQogICAgICAgICAgUlggcGFja2V0czoyMDY3NTY0IGVy
- cm9yczowIGRyb3BwZWQ6MCBvdmVycnVuczowIGZyYW1lOjAKICAgICAgICAgIFRYIHBhY2tldHM6
- ODg2NDUgZXJyb3JzOjAgZHJvcHBlZDowIG92ZXJydW5zOjAgY2FycmllcjowCiAgICAgICAgICBj
- b2xsaXNpb25zOjAgdHhxdWV1ZWxlbjoxMDAwIAogICAgICAgICAgUlggYnl0ZXM6MjAzNDkzNTEx
- ICgxOTQuMCBNaUIpICBUWCBieXRlczozMjUyNzUxNiAoMzEuMCBNaUIpCgpsbyAgICAgICAgTGlu
- ayBlbmNhcDpMb2NhbCBMb29wYmFjayAgCiAgICA gICAgICBpbmV0IGFkZHI6MTI3LjAuMC4xICBN
Lab environment: Under Vbox, Rehat5 virtual machine Using samba server Purpose: Upload file to serv
Greg Kroah-Hartman today announced the seventh release of Linux Kernel 3.15, which is small
If you want to try a desktop system other than Mac and Windows, Linux should definitely be y
on Linux A traditional VPN (such as OpenVPN, PPTP) consists of a VPN server and one or more clients
Remove duplicate data from file
Linux process management related content
10 most common questions about Linux
Linux interrupt processing flow
Linux related use--Great God passed
Linux system reloading and restoring
Taglist and ctags installation in Ubuntu, simple and clear
How to make software packages under Linux system
Linux add custom script to boot self-start method
Linux SSH Session replication function implementation method
How to fix the boot menu of Win7 dual system
How to use Finaldata under XP system
Windowsserver2012 when prompted to install .NETFramework can not find the source file
Large hard disk recommended for Windows 7 system partitioning scheme
How to open aero win10? Windows10 open aero frosted glass effect tutorial
Windows 8 fails to prevent the PC era from coming
The Win8 computer system has a blue screen fault code 0x00000019 solution
Windows 7 Tips: Add a copy move command to the right mouse button menu
"Not found the kernel library or the kernel library is invalid" What is the solution?