SSH connection without password between two linux machines

Overview

How to establish SSH connection without password between two linux/unix machines

SSH connection without password between two linux machines

Instructions

  1. Generate the files: [id_rsa], [id_rsa.pub] in the First Machine by typing at command (do not use a password – just hit Enter*) :
    ssh-keygen

    * You don’t want to enter any passwords, because you want to call ssh from a within a shell script.
    ** The randomart is an easier way for humans to validate keys.
  2. Copy (and rename) id_rsa.pub to authorized_keys on Server (run from the same computer you run ssh-keygen);
    scp -r -P 22 /root/.ssh/id_rsa.pub destination:/root/.ssh/authorized_keys<em>
    </em>

    Where destination is server B.

Now you can connect as root without a password between the servers.

2 thoughts on “SSH connection without password between two linux machines

  1. John Michael Sheehan

    Thank you for the sensible critique. Me & my cousin were just preparing to do some research on this. We got a book from our local library but I think I learned better from this post. I’m very glad to see such great info being shared freely out there…

    Reply

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.