Skip to content

Instantly share code, notes, and snippets.

@parabuzzle
Created December 15, 2008 20:55
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 parabuzzle/36085 to your computer and use it in GitHub Desktop.
Save parabuzzle/36085 to your computer and use it in GitHub Desktop.
#!/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