Archive of January 2011
SSH Public Key Uploading Script
After my previous post, I realized I've wanted a simple way of uploading & authorizing my public key on new servers. After some searching I found a script that I tweaked a bit and put it on gist.
This gist has 2 versions, one is a shell function, the other a shell script. For some people it'll probably be easier just grabbing the script and putting it in their path like at /usr/local/bin/sshput. Some might like putting it in their zshrc, profile, etc. as a shell function which is what I did.
First file is function, second is the script:
After it's installed, you can easily upload & authorize your public key on a new server:
sshput myserver.local
It'll ask for your password for the server, then transfer the key and append it to ~/.ssh/authorized_keys on the server. By default the script uploads your rsa or dsa key but you can specify a specific key:
sshput ~/.ssh/github_key.pub myserver.local
Hope that helps out with making ssh key authentication easier, I definitely like having a 1 step setup for authorizing a key now.
05:33 PM | Tags: ssh, sysadmin, servers, shell, scripts