Sunday 17 July 2011

Script to transfer SSH Keys

A simple script to send RSA public key to a remote SSH server so we can avoid typing a password.
#!/bin/bash                                 
cat ~/.ssh/id_rsa.pub | ssh $1 "mkdir .ssh; cat - >> ~/.ssh/authorized_keys; \
chmod a-w ~/.ssh; chmod og-rw ~/.ssh/authorized_keys"

No comments:

Post a Comment