#!/bin/sh if [ -z $1 ] ; then echo "Usage: $0 [servername | username@servername]" echo "Will copy your ~/.ssh/id_dsa.pub key to remote machine" echo "as ~/.ssh/authorized_keys2 (appending if exists) and" echo "correcting permissions." exit 1; fi cat ${HOME}/.ssh/id_dsa.pub | ssh $1 "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys2 && chmod 644 ~/.ssh/authorized_keys2 && cat - >> ~/.ssh/authorized_keys2"