Created
September 10, 2015 15:30
-
-
Save karlkfi/587155a2c8b2cd7d15ce to your computer and use it in GitHub Desktop.
Temporarily authorize a Mac with an SSH key from a USB drive
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
#!/usr/bin/env bash | |
hours=$1 | |
script_dir="$(cd "$(dirname "${BASH_SOURCE}")" && pwd)" | |
drive_mount="$(cd "${script_dir}/.." && pwd)" | |
key_path="${script_dir}/id_rsa" | |
if [ -z ${hours} ]; then | |
hours=1 | |
fi | |
/usr/bin/ssh-add -D | |
/usr/bin/ssh-add -t ${hours}H "${key_path}" | |
/usr/sbin/diskutil umount force "${drive_mount}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment