SSH Keys Tricks

SSH With Identity Key:

sudo ssh -i /home/myself/.ssh/id_rsa user@domain.com

SSH Agent Forwarding:

eval `ssh-agent`
sudo ssh -A user@domain.com

Appending File Using SSH:

cat id_rsa.pub | ssh user@host.domain.com 'cat >> /home/user/.ssh/authorized_keys'
cat ~/.ssh/id_dsa.pub | ssh user@host.domain.com 'mkdir .ssh; cat >> .ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh user@domain.com 'cat >> .ssh/authorized_keys'
for i in server1 server2 server3 server4; 
do 
    echo "sending file to $i";
    cat localfile | ssh -p portnumber user@$i "cat >> remotefile"; 
done;

SSHFS With Identity Key:

sshfs -o idmap=user -o ssh_command="ssh -i /root/server.pem"  user@domain.com:/media/vol /mnt/partition
sshfs -o sshfs_sync -o idmap=user apache@domain.org:/var/www/srv DevOps/