Solved

How to use rsync to download files to another server?

Posted on 2010-11-16
11
268 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
 
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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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 …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now