Simple Shell Random Password Generator
A very simple script to generate a random secure password of desired length. This can come in handy when setting up multiple user account and/or lacking imagination.
#!/bin/bash
# Random password generator
if [ $# -gt 0 ];then m=$1;else m=8;fi
d=$(expr $RANDOM % 5);l=$(expr ${m} + ${d})
cat /dev/urandom | tr -dc "a-zA-Z0-9@#*=" | dd bs=${l} count=1 2>/dev/null;echo

to get a random password of, say 6 characters, I find this the easiest way.
$ openssl rand -base64 6