Last Updated: February 25, 2016
· jimeh

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/ to the path of your own public key file.

function authme {
  ssh "$1" 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' \
    < ~/.ssh/