Performing SSH login without typing your password (via ssh-keygen & ssh-copy-id)

We all know SSH and have used it to connect to remote hosts.

The annoying thing about it (when using it frequently) is that you have to enter your password each time.

If you want to bypass that, as I wanted, keep reading..

  1. Firstly, on your local machine type this:  ssh-keygen
  2. You will be prompted to “Enter file in which to save the key
    just hit [enter].If you don’t want to assign a pass phrase (press [enter] key twice). It will create 2 files in ~/.ssh directory as follows:

    • ~/.ssh/id_rsa : identification (private) key
    • ~/.ssh/ : public key


  3. Now we want to secure copy the public key to the remote host.
    We’ll do that with ssh-copy-id:
    ssh-copy-id -i ~/.ssh/ user@remote-host
  4. Finally, you are able to login to the remote host using ssh username@remote-host without typing your password.

Leave a Comment

Your email address will not be published. Required fields are marked *