If you haven't already got a ~/.ssh/id_rsa.pub on your computer, you'll need to generate one.
To generate key
ssh-keygen
To copy ssh key to your clipboard on a mac:
pbcopy < ~/.ssh/id_rsa.pub
To copy your key right onto the server and create /.ssh directory if needed
cat ~/.ssh/id_rsa.pub | ssh -p 22 user@server.com "umask 0077; mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"
Add this to your .bash_aliases for an awesome shortcut.
rsaup(){
port=$2
if [ -z "$port" ]; then
port="22"
fi
cat ~/.ssh/id_rsa.pub | ssh -p $port $1 "umask 0077; mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"
}
Usage: rsaup root@server.com 2200