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
Filed Under
Did you know?
Account takeover often starts in the browser, on the login page itself. A malicious script can read credentials, tokens, or one-time codes as the person types them.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#