Skip to content

Instantly share code, notes, and snippets.

@dideler
Created May 15, 2015 07:49
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 dideler/d2a726a85bc48686aebb to your computer and use it in GitHub Desktop.
Save dideler/d2a726a85bc48686aebb to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Script to load keys and (force) eject.
# If no hour value is given for the key's lifetime, it defaults to 4 hours.
#
# Usage (OS X):
# /Volumes/keys/load <optional hour value>
# <enter decryption password>
HOURS="$1"
DIR="/Volumes/keys"
KEY="$DIR/id_rsa"
if [ -z $HOURS ]; then
HOURS=4
fi
/usr/bin/ssh-add -D # Delete all identities on the machine.
/usr/bin/ssh-add -t ${HOURS}H $KEY
/usr/sbin/diskutil umount force $DIR
@dideler
Copy link
Author

dideler commented Apr 2, 2017

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