Shell function to add your public key to a remote machine via SSH
I ripped this from someone else's dotfiles on GitHub a while back, and added the mkdir -p ~/.ssh part incase the folder doesn't exist on the remote machine.
Think of it as a lightweight, dumber and dependency-free version of ssh-copy-id :)
To use it make sure to change the ~/.ssh/id_dsa.pub to the path of your own public key file.
function authme {
  ssh "$1" 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' \
    < ~/.ssh/id_dsa.pub
}Written by Jim Myhrberg
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Shell 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
 
