Created
December 15, 2008 20:55
-
-
Save parabuzzle/36085 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
#This script pushes your public keys to a remote host. | |
# | |
#Created by Mike Heijmans - parabuzzle@yahoo.com | |
host=$1 | |
username="" | |
#test for host | |
if [ "$host" == "" ]; then | |
echo "Need to specify a host to push to" | |
echo "usage: push_keys hostname" | |
exit 1; | |
fi | |
#Make sure the authorized_keys file exitst | |
echo "checking for keys" | |
if [ -e ~/.ssh/authorized_keys ]; then | |
echo "authorized_keys files exists" | |
else | |
echo "authorized_keys file is missing. Please create ~/.ssh/authorized_keys and put your public keys in it." | |
exit 1; | |
fi | |
#Push the keys to the host | |
echo "pushing the keys to the host" | |
scp ~/.ssh/authorized_keys $username@$host:~/.ssh/authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment