.bashrc

genpwd()
{
  openssl rand -base64 $1|tr -d '\n'|{ read in; echo ${in:0:$1}; }
}

Пример использования:

$ genpwd 8
vBu8waCQ
$ genpwd 16
heitMPgrsMgKR1yk