Linux: Generate random password
Revision as of 07:52, 5 March 2019 by Rafahsolis (talk | contribs) (Created page with "<syntaxhighlight lang="bash"> # Using date date +%s | sha256sum | base64 | head -c 32 ; echo # Using urandom < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo; < /dev...")
# Using date
date +%s | sha256sum | base64 | head -c 32 ; echo
# Using urandom
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo "" # Left hand will let you write password with one hand
# Using OpenSSL
openssl rand -base64 32
# Using tr
tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1
# Using strings
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo
# Using dd
dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev