SSH Login using private key without password in Linux

Here is the step by step to make you using private key to login Linux without password.

As daily working, we always do some tedious things, like login to serveral remote servers by ssh and then type serveral times password.

we can login using private key instead of type password, just do the following easy steps:

Step 1) Generate SSH key in your local Linux environment.

ssh-keygen -t rsa

You could using all default settings for the prompt, and it should generate a pair of key, private key and public key, we will put the public key to the remote host.

~/.ssh/id_rsa
~/.ssh/id_rsa.pub #this one should copy to the remote server

Step 2) Copy the public key to remote host which you would like to connect.

ssh-copy-id -i ~/.ssh/id_rsa.pub remote_user@remote_server_ip

Step 3) Login

ssh remote_user@remote_server_ip

Leave a Comment