Last active
December 17, 2015 22:59
-
-
Save chorrell/5686383 to your computer and use it in GitHub Desktop.
Backup ssh keys from your Joyent account to /root/.ssh/authorized_keys. Don't forget to change ACCOUNT, DC, and AUTHORIZED_KEYS. Schedule this via cron to always ensure you have a recent backup NOTE: this assumes you have smartdc (the latest 7.0 version) and jsontool installed (via npm): 'npm install smartdc -g; npm install jsontool -g`
This file contains hidden or 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
#!/bin/bash | |
PKGSRCPATH=/opt/local | |
ACCOUNT=YOUR-USER-NAME | |
FINGERPRINT=`ssh-keygen -l -f ~/.ssh/id_rsa.pub | awk '{print $2}' | tr -d '\n'` | |
URL=https://DC.api.joyentcloud.com | |
AUTHORIZED_KEYS=/root/.ssh/authorized_keys | |
${PKGSRCPATH}/bin/sdc-listkeys --account ${ACCOUNT} --keyId ${FINGERPRINT} --url ${URL} | ${PKGSRCPATH}/bin/json -a key > ${AUTHORIZED_KEYS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment