Solved

How to use rsync to download files to another server?

Posted on 2010-11-16
11
281 Views
Last Modified: 2012-05-10
There are 2 SUSE SLES11 servers in this setup. Both servers are located behinds firewall, and communicate through Internet. I intend to use rsync to frequently download the latest files from serverA to serverB. How should I setup the whole project? I heard that I can use SSH on top of rsync, is that right, and how it work?
0
Comment
Question by:Balack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 2

Expert Comment

by:ckiral
ID: 34146895
Hi,

By default rsync will use ssh fot transport method. So if you have ssh connectivity between servers you can eaily acoomplish your transfer...

The syntax is straightforward:
to copy files from server a to b type
rsync filename username@serverB:/destination/directory

Open in new window

For detailed how-to try man rsync
0
 

Author Comment

by:Balack
ID: 34147641
What ports have to be opened in sender's and recipeint's firewalls?
0
 
LVL 2

Expert Comment

by:ckiral
ID: 34147789
Allowing tcp port 22 from source to destination (from A to B in my example) will be enough.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 2

Expert Comment

by:ckiral
ID: 34147927
By the way to download file from server B you have to use command as follows:


rsync username@serverB:/directory/filename  /directory/

Open in new window



My first version was uploding to server B ....
0
 

Author Comment

by:Balack
ID: 34154561
I intends to schedule to run the rsync in cron job, and password prompt is not allowed. I heard that SSH is needed to setup with public and private keys. Is that true? If so, what are those steps?
0
 
LVL 2

Accepted Solution

by:
ckiral earned 500 total points
ID: 34154828
Hi Ballack,
I think following  tutorial will be usefull in that context:
http://troy.jdmz.net/rsync/index.html

0
 
LVL 2

Expert Comment

by:maxalarie
ID: 34159491
use options..  rsync -alvzn   $localDir  host:$remoteDir

z = compress (speeds transfer between hosts)
n = Dry run, it will test the command only. rerun the same command without -n to execute it.
l = follow  symlinks
-a : Archive Mode

So you would use this command: rsync -alvzn rsync filename username@serverB:/destination/directory
Then, if everything passes,  run the same command without n:
rsync -alvz rsync filename username@serverB:/destination/directory
0
 
LVL 2

Expert Comment

by:maxalarie
ID: 34159504
Sorry about the double post..    you use only 1 rsync (copy paste ftl)


rsync -alvzn filename username@serverB:/destination/directory #Test
rsync -alvz filename username@serverB:/destination/directory #actual command

Open in new window

0
 

Author Comment

by:Balack
ID: 34160759
I tested files/folders can be copied successfully. The main issue now is password prompting. How can I run without password prompting? As I intend to run it as a cron job.
0
 
LVL 2

Expert Comment

by:ckiral
ID: 34163521
Hi Ballack,
You can find detailed instructions on the link i provided...
--
0
 

Author Closing Comment

by:Balack
ID: 34179407
It works like a charm
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question