Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Last active November 4, 2024 04:24
Show Gist options
  • Save vpnwall-services/ddb8a6b81d8d9460cd8d73f2b0ec3457 to your computer and use it in GitHub Desktop.
Save vpnwall-services/ddb8a6b81d8d9460cd8d73f2b0ec3457 to your computer and use it in GitHub Desktop.
[Generate random password] Generate a password randomly #linux # generate #password
#!/bin/bash
# Echo three passwords
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%+'|fold -w 28| head -n 3
# Echo one password and put it in clipboard
# Requirements: apt-get install -y xclip
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%+'|fold -w 28| head -n 1|xclip"
openssl rand 60 | openssl base64 -A
# another method (suitable for alerta)
LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 32 && echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment