Setup up ssh to login without entering password

Considering situation where we need to connect from Server A to Server B

  • On Server A, run the below command to generate the public key

    ssh-keygen -t rsa

    Note: If you don’t have ssh-keygen command recognized in your system, install Git – which will provide required file for running ssh-keygen command.

    After installing Git, add this/similar path to your system environment variable C:\Program Files (x86)\Git\bin\ssh-keygen.exe

    This command should generate id_rsa.pub file in your <homedir>/.ssh/ directory

  • On Server B

    create a folder in the <homedir> with name .ssh

    Copy the id_rsa.pub file from Server A, into this .ssh directory.

    Append the contents of id_rsa.pub file to authorized_keys file inside the .ssh directory on Server B.  If one authorized_keys file does not exist – create it.

That’s it! now we should be able to login without having to enter password every single time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s