Linux Guides & Reviews
RSS icon Home icon
  • Copy SSH Key to Server in One Line

    Posted on September 26th, 2009 admin No comments

    Here is a simple way to copy your public key from your computer to your server (which can allow password-free login):

    ssh user@hostname "echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys"

    If you receive an error about ~/.ssh/id_rsa.pub not existing, run the following to create it first:

    ssh-keygen -t rsa