• ARTICLES
SEARCH

How-To Geek

Add Public SSH Key to Remote Server in a Single Command

If you want to setup SSH keys to allow logging in without a password, you can do so with a single command.

The first thing you’ll need to do is make sure you’ve run the keygen command to generate the keys:

ssh-keygen -t rsa

Then use this command to push the key to the remote server, modifying it to match your server name.

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 07/16/10

Enter Your Email Here to Get Access for Free:

Go check your email!