Bash function to copy SSH DSA public key to a new server
First of all, you'll need to have generated an SSH public DSA key using the following commands:
cd ~ && ssh-keygen -t dsa
Then, you can add the following bash function to your .bashrc (or similar) and just type 'scpdsa user@hostname' to add your public key to your 'authorized_keys' file on the server.
function scpdsa { if [[ -z "$1" ]]; then echo "!! You need to enter a hostname in order to send your public key !!" else echo "* Copying SSH public key to server..." ssh ${1} "mkdir -p ~/.ssh && cat - >> ~/.ssh/authorized_keys" < ~/.ssh/id_dsa.pub echo "* All done!" fi }
-- updated to use simpler and quicker method.