Generate a 40-character alphanumeric password

The tr step strips characters that are invalid in most database password fields.

openssl rand -base64 32 | tr -d '/+=' | head -c 40

References: