Created
May 5, 2018 18:34
-
-
Save BassyKuo/50da0ae6f3528b58f32a1ca43d0d6367 to your computer and use it in GitHub Desktop.
Generate random password.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Uasge: | |
# getpasswd 64 ~/.vnc/passwd | |
# | |
length=${1:-128} | |
passwdfile=${2:-$HOME/.vnc/passwd} | |
if su -c true $USER ; then | |
head /dev/urandom | tr -dc 0-9a-zA-Z_ | head -c $length | tee /dev/tty | /usr/bin/vncpasswd -f > $passwdfile | |
echo "" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment