Tuesday, July 12, 2011

Linux to generate a random password

1 install expect
yum install Expect
2 command line
mkpasswd -L  32  -d  5  -C  5
The above command generates a 32-bit password at least 5 numbers and 5 upper case letters, such a powerful password and slowly break it:)
3 scripting, batch generate 30 passwords
vi pass.sh 
 #! / bin / bash 
 
i = 1  
echo  "######## Power by gaojinbo.com ##########"  > / tmp / passwd.txt 
 while  [  $ i  -le  30  ] ; do  
/ usr / bin / mkpasswd -L  32  -d  5  -C  5  >> / tmp / passwd.txt 
 let i + = 1  
done  
exit ;
The above script will generate a password on the / tmp / passwd.txt file
Done!