passwordless ssh

how to connect to a remote server via ssh without entering a password

this is for openSSH client and server:

  1. create a key on your client machine:
    ssh-keygen -t rsa
    (or)
    ssh-keygen -t dsa
  2. select location. it's fine to leave it as default
  3. append the key to the remote server:
    cat ~/.ssh/id_rsa.pub | ssh you.server.addr "cat - >> ~/.ssh/authorized_keys"
    (or)
    cat ~/.ssh/id_dsa.pub | ssh your.server.addr "cat - >> ~/.ssh/authorized_keys"

To keep ssh session alive, edit on your machine ~/.ssh/config file to say ServerAliveInterval 180 or some other number. This sends signal to server every 180 sec to prevent being seen as idle.


back to main page