A while ago I did a write up on SSH keys, anyways I was looking into it a little more today and came across this handy little script that makes it… well simple. I didn’t write it myself, I found it over here. Go ahead and give it a try it works like a charm.
#!/bin/bash # say: ./pussh.sh hostname # Uploads your id_rsa.pub to the specified host, wrapped for readability if [ ! -r ${HOME}/.ssh/id_rsa.pub ]; then ssh-keygen -b 2048 -t rsa fi # Append to the copy on the remote server cat ~/.ssh/id_rsa.pub | ssh ${USER}@ "cat - >> .ssh/authorized_keys" if [ $? -eq 0 ]; then echo "Success" fi