Passwordless SSH Between Machines

Tutorials

When building a Linux machine, sometimes it becomes necessary to set up cron jobs to transfer files or logs from one machine to another on a regular basis.  If this is the case, I recommend setting up password-less SSH from one machine to the other.  I decided to post about this here because it always took me a while to find the right commands or tutorial online to get it to work.  Finally I found a great post from the Debian Administration team.  Here is quick summary/tutorial.

To make passwordless connections, you first need to generate the appropriate SSH keys on the connecting computer.

$ ssh-keygen -t rsa
  1.  
  2.  
  3. <p>Make sure to not set a passphrase - that defeats the purpose.  Then transfer your public key to your target computer (in this case the user <em>username </em>from the computer named <em>target</em>)</p>
  4.  
  5. <pre lang="bash">$ ssh-copy-id -i ~/.ssh/id_rsa.pub username@target

There we go, password-less SSH should be working one-way.  If you wish to set it up the other direction, just run the same commands from the other machine (replacing the username@target).

For a more detailed tutorial, check out the Debian post about it.

No Comments

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Donate

    If my work has helped you and you want to return the favor, you could purchase something for me from my Amazon Wish List or send me a donation via PayPal.

  • License

    Unless otherwise noted, all source code and compiled files published on this website are released under the terms of the GNU Lesser General Public License.