4 ms·
Here's a function you can use to generate a strong printable password on the fly: function gen_passwd () { openssl rand 150 |\ tr -dc '[:g
by Tepix 8y ago
Here's a function you can use to generate a strong printable password on the fly:
function gen_passwd () {
openssl rand 150 |\
tr -dc '[:graph:]' |\
cut -c 1-${1:-13}
}
The default password length is 13 characters but you can pass a different length parameter instead.
Explanation:
* generate 150 pseudo-random bytes using openssl's rand
* discard non-printable characters
* cut to desired length
Note that it will only use the ASCII character set, if you prefer a solution that also uses german umlauts (öäüÖÄÜß) or something more exotic like emoji in your passwords you're on your own.