oldjamey
6/13/2013 - 10:59 PM

will automatically exchange ssh keys with remote server, allowing automatic future password-less access to the remote location from current

will automatically exchange ssh keys with remote server, allowing automatic future password-less access to the remote location from current location. edit as needed if remote location doesn't run sshd on default port.

#!/bin/bash

printf "enter username@ip-address: " ; read UIP ; ssh $UIP "mkdir .ssh 2>/dev/null ; echo $(cat $HOME/.ssh/id_rsa.pub) >>.ssh/authorized_keys ; chmod 700 .ssh ; chmod 600 .ssh/authorized_keys" ; echo "hostname=$(ssh $UIP hostname)"