Created
January 4, 2010 19:11
-
-
Save kch/268764 to your computer and use it in GitHub Desktop.
puts your ssh public key(s) on a remote server in a single command without fuss
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 | |
if [ $# -lt 1 ]; then | |
echo "Usage: `basename $0` <destination_ssh_connection_arguments>" | |
echo "Adds your public keys to a remote server." | |
exit | |
fi | |
ssh $@ " | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
touch ~/.ssh/authorized_keys | |
chmod 600 ~/.ssh/authorized_keys | |
echo '$(cat ~/.ssh/id_*sa.pub)' >> ~/.ssh/authorized_keys | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment