Linux generates random password method:
strings /dev/urandom |
Grep -o ‘[[:alnum:]]’ |
Head -n 30 |
Tr -d ‘n’; echo
Linux password change method:
passwd root
Then enter the new password twice
root can be replaced with Users who need to be modified
In addition to the above random password generation we have other methods
1. Use the mkpasswd command:
To use the mkpasswd command, you need to install the expect module in advance. CentOS is an example:
yum -y install expect
After installation, run mkpasswd directly to generate a random password. And the command has parameters, such as setting the minimum length of the generated random password, etc., look at the help to know.
2. Use the passwdgen command:
is roughly the same as mkpasswd. You need to install the passwdgen module beforehand:
yum -y install passwdgen
After installation, Run passwdgen directly to get a random password. The same passwdgen command also has parameters. You can refer to help.
Add some commands to generate random passwords
Here are ten examples of generating random passwords
1.SHA+date+base64, password length 32 date +%s |
Sha256sum |
Base64 |
Head -c 32 ; echo
2. Use urandom to filter out other symbols, leaving only letters and numbers, password length 32 < /dev/urandom tr -dc _A-Z-a-z-0-9 |
Head -c${1:-32};echo;
3. Use the random function of openssl openssl rand -base64 32
Another use of urandom, urandom+tr tr - Cd '[:alnum:]' < /dev/urandom |
Fold -w30 |
Head -n1
5. Use urandom plus character function strings /dev/urandom |
Grep -o ':alnum:' |
Head -n 30 |
Tr -d 'n'; echo
6. The simplest use of urandom < /dev/urandom tr -dc _A-Z-a-z-0-9 |
Head -c6
Another use of 7.urandom, urandom+dd dd if=/dev/urandom bs=1 count=32 2>/dev/null |
Base64 -w 0 |
Rev |
Cut -b 2- |
Rev
8. If you often use a one-handed password, you can refer to the following method to generate "left-hand password" /dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' |
Head -c8; echo ""
9.Use randpw plus urandom randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9 |
Head -c${1:-16};echo;}
10. Finally, the most concise date |
Md5sum
Under Linux is a regular software installation method in addition to binary form of software distrib
Everyone knows that shell script is like a batch file (.bat) in the early DOS era. The simplest fun
Currently, a very serious Bash vulnerability has been exposed on the Internet. It
In the window we can implement multiple IP addresses for one network card and load balancing and re
CCIE technical theory study recommendations
Linux/UNIX Awk Command Tutorial with Examples
Modify the Ali cloud Linux VPS host username method
How to safely delete PV physical volumes (hard disks or partitions) in Linux LVM
Source code reading tool under Windows platform Source Insight
Linux modify mysql data file path
IPsec, site-to-sito VPN Simple Experiment
Modify oracle character set under linux to solve Chinese garbled code
Introduction to several important Linux system kernel files
Linux wc command parameters and usage details
Two strokes per second to determine whether your Win7 system can be a wireless router?
Au how to record the sound on the computer
How to remove the extra removal hardware in the lower right corner of the computer
Win10 Mobile Preview 10549 Known Issues and Solutions Daquan
Window Server 2008 R2 TFS2010 Pre-installation preparation
How does Win7 system create a broadband connection icon?
Windows system how to turn off automatic updates
Teach you to adjust the drive letter under Vista
Computer prompts to configure windows update failure Do not turn off the computer or not?