How To Login and RSYNC to a Remote Host with SSH without password prompt

Step 1 – Setup public SSH keys

On the local server, generate the public SSH keys with no password:

ssh-keygen -f ~/.ssh/id_rsa -q -P ""
cat ~/.ssh/

This is the public SSH key that can be placed on other hosts to provide no-password required access:

ssh-rsa AAA...[*] root@boomclickclick

Copy this key to your clipboard and login to the remote (destination) server.

Place this SSH key into your ~/.ssh/authorized_keys file:

If your SSH folder does not exist, create it manually:

mkdir ~/.ssh
chmod 0700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 0644 ~/.ssh/authorized_keys

 Step 2: Login to the Remote Server from the Local Server


Now, if you wanted – you could rsync a folder to the remote host without logging in.

Make sure that you have rsync installed on the destination server, and then exit out of the remote server and do the same on your source server. Next, issue an rsync command, something like below, but adjusted to your circumstance. The trailing / in the example below means that I’m syncing a folder and not a file.

rsync -avz -e 'ssh' --delete /foo/bar/test/

The next project is to create a shell script and create a cron job to run the rsync at a specified interval.

I’ve used this to rsync folders from Apple OS X Mavericks, Scientific Linux 6.5 and Debian Wheezy,



Using Cygwin in Windows 8.1, there is a command need to be run in Windows Cygwin window:

chgrp Users ~/.ssh/id_rsa

Then the solution posted here can be applied, 400 or 600 is OK.

chmod 600 ~/.ssh/id_rsa

Published by J.W. Spencer

JW Spencer is the lead technical architect and developer at the Digital Dream Team. He has over 25 years of technical experience in private industry and government in support of development, management, project management, and executive technical leadership. JW has the unique ability to understand complex technical problems and synthesize viable solutions. A veteran of the USMC, JW took his undergraduate studies at Southwest Texas State University, with graduate work at Texas A&M and the University of Texas at Austin. "Always go to other people's funerals, otherwise they won't come to yours." - Yogi Berra

Leave a comment

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