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
Solved

How to use rsync to download files to another server?

Posted on 2010-11-16
11
276 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

856 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