Is this possible to create a random password in my Ubuntu bash?
I need the password to be capital/small/number/symbol.
The length of password should be exactly 66.
Yes, it is possible:
< /dev/urandom tr -dc 'A-Za-z0-9@#$%^&*()_+-=~`[]{};:,.<>?/|\\' | head -c 66; echo
The /dev/urandom
is a source of random data in Linux. The tr
filters specific characters from your set. And head
will limit the characters to your specific length.
Please note that, /dev/urandom
is not cryptographically secure.
For cryptographically secure random data generation, use openssl
as follows:
openssl rand -base64 48 | tr -dc 'A-Za-z0-9@#$%^&*()_+-=~`[]{};:,.<>?/|\\' | head -c 66