Skip to content

Instantly share code, notes, and snippets.

@husobee

husobee/keyadd.sh

Created Jan 26, 2017
Embed
What would you like to do?
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 -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment