-
-
Save yyolk/5017439 to your computer and use it in GitHub Desktop.
simple helper for copying my ssh keys to new machines. ((useful if you're trying to deal with 10 pi's and reformat them almost every day))
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
#!/bin/bash | |
# simple script to get a ssh-key on a remote machine | |
# assumes you're using id_rsa as your identity file which is the default from `ssh-keygen` | |
# usage: ./scpk <[user@]host> | |
# ie: `./scpk pi@raspberrypi` or `./scpk raspberrypi` | |
# default to 'raspberrypi' if no host is provided | |
TARGET_HOST=${1:-"raspberrypi"} | |
ssh $TARGET_HOST "echo `cat $HOME/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment