Skip to content

Instantly share code, notes, and snippets.

@bwiggs
Created June 4, 2014 17:46
Show Gist options
  • Save bwiggs/05ca7cc51e610bc3fab1 to your computer and use it in GitHub Desktop.
Save bwiggs/05ca7cc51e610bc3fab1 to your computer and use it in GitHub Desktop.
CLI Password Generator with openssl
function genpasswd() {
let passwordLength=${1:-48}
openssl rand -base64 $passwordLength | cut -c 1-$passwordLength
}
# $ genpasswd 24
# qPE5rpQOF74k8SoibCFzhlwp
@corbanb
Copy link

corbanb commented Jun 9, 2014

If you add | pbcopy to this line it will be in your clipboard. :)

function genpasswd() {
    let passwordLength=${1:-48}
    openssl rand -base64 $passwordLength | cut -c 1-$passwordLength | pbcopy
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment