#!/bin/bash #Places your public keys on a remote server; passwords will no longer be needed after this. #V0.1 #Usage: quick-ssh-keyinstall server1 user@server2 anotheruser@server3... while [ -n "$1" ]; do cat ~/.ssh/{id_dsa.pub,id_ecdsa.pub,id_rsa.pub} 2>/dev/null \ | ssh "$1" 'mkdir -p .ssh ; cat >>.ssh/authorized_keys ; chmod go-rwx ./ .ssh/ .ssh/authorized_keys' if ssh -o 'PasswordAuthentication=no' -o 'PreferredAuthentications=publickey' "$1" 'touch .ssh/reached-by-key ; true' 2>/dev/null ; then echo "==== Key appears to be successfully installed on $1" fi shift done