Skip to content

Instantly share code, notes, and snippets.

@husobee
Created January 26, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save husobee/c375d73316c30fc40279fcee44bdfffb to your computer and use it in GitHub Desktop.
Save husobee/c375d73316c30fc40279fcee44bdfffb to your computer and use it in GitHub Desktop.
using passwordstore with ssh-add
#!/bin/bash
PASS_NAME=$1
KEY_FILENAME=$2
# start ssh-agent
eval `ssh-agent -s`
# decrypt the rsa private key, using the password from the `pass` command by means of a named pipe
openssl rsa -inform PEM -passin file:<(pass show ${PASS_NAME}) -in ${KEY_FILENAME} -text | ssh-add -
@georgjaehnig
Copy link

Thanks for the idea! I kept getting errors with openssl, so here's my approach, using expect:

https://gist.github.com/georgjaehnig/217c004decb58877a2eebd05788d1dee

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