I am just dropping that here. This is sshfix.sh - a small tool I use to enable SSH login to a remote host.
I use it the same way I use ssh:
./sshfix.sh delian@remote-host
The code:
#!/bin/sh
[ -f ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -b 2048; ssh $* "(mkdir -p ~/.ssh; echo \"$(cat ~/.ssh/id_rsa.pub)\" >> ~/.ssh/authorized_keys)"