Quick Linux Tip #107:
Question: I need to generate secure passwords without using a website.
Try: openssl rand -base64 32 | tr -d '/+=' | cut -c1-20
Info: Generates cryptographically secure random bytes from OpenSSL.
Examples:
- $
pwgen -s 20# Generate fully random 20-character passwords - $
head /dev/urandom | tr -dc A-Za-z0-9 | head -c 20# Pure bash random string generation - $
openssl rand -hex 16# Generate a 32-character hex string
Note: Modern Linux kernel entropy (/dev/urandom) is cryptographically secure. Avoid using $RANDOM for passwords as pseudo-random generators are predictable.
Leave a Reply