BASH - Simple random password generator
Posted 1 year, 5 months ago at 8:20 pm. 2 comments
Ever wondered how cool it will be to have an random password generator in your shell?
Here’s a little bash script i wrote:
Put this
#!/usr/local/bin/bash
if [ -n $1 ]; then
CHARS=$1
while [[ "$COUNT" -ne "$CHARS" ]]; do
let COUNT=COUNT+1;
done
else
COUNT=8; # DEFAULT NUMBER OF CHARACTERS
fi
/usr/bin/perl -le'print map+(A..Z,a..z,0..9)[rand 62],1..'$COUNT;into /usr/local/bin/passgen and then chmod it properly:
[root@box ~]# chmod +x /usr/local/bin/passgen
Now try it in action:
[root@box ~]# passgen UJXG1JMx [root@box ~]# passgen 15 l3LMgNOuCK3OYnH [root@box ~]# passgen 1 J [root@box ~]#
Have fun! :-P
Allright, tole bo prišlo zelo prav. Tnx!
Jap, kr zdele shranu, pride tole velikrat prou…Ty