SSH without a Password


Entering passwords is really annoying if you SSH into servers on a regular basis. Here’s how to add your SSH key to the remote host so you no longer have to do so!

  1. Start on your local machine (the machine you use to tap into the remote host)
  2. Copy id_rsa.pub to home directory of remote host

    $ scp ~/.ssh/id_rsa.pub [user]@[remote hostname]:~
  3. SSH into server and enter password. Celebrate that this will be the last time you will need to do this.

    $ ssh [user]@[remote hostname]
  4. Add id_rsa.pub to authorized_keys

    $ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
  5. Remove id_rsa.pub and exit remote server

    ~ $ rm ~/id_rsa.pub
    ~ $ exit
  6. Test it! You should no longer be prompted to enter a password!

    $ ssh [user]@[remote hostname]

There are alot of assumptions made in this guide, so if you run into problems, the Ubuntu Community Wiki is very helpful for troubleshooting!

comments powered by Disqus