Thursday, November 30, 2017

SSHfix.sh - the small tool I use to enable SSH public/private key login

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)"