LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-11-2009, 12:12 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Rep: Reputation: 51
How to use Rsync?


I have a file pluto.sh on each machine(ubuntu Fiesty and Fedora 7).
Everytime developer update the file with codes to Fedora 7 machine.All I want is to rync it to Ubuntu Fiesty.
How can it be possible with rsync?
 
Old 02-11-2009, 02:42 AM   #2
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
Code:
rsync -avz file_name user@host:/path_to_store
you will need ssh keys installed as the default transport for rsync is ssh.
 
Old 02-11-2009, 06:24 AM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
I tested it manually in this way:

I created a folder called pit under /opt on ubuntu machine. Under that I create a file called kally.
I edited kally and wrote:
Code:
How are you ?
Now I went to Fedora Machine and created the same folder and file.I edited the same line.

Now On Ubuntu I ran the command:

Code:
rsync -avz kally vjs@fedora7:/opt/pit
It asked me for password and displayed:
Code:
building file list ... done
pit

sent 97 bytes  received 46 bytes  57.20 bytes/sec
total size is 14  speedup is 0.10
But I dint see any changes if I make any changes on one machine.
Correct me if I am wrong at the steps
 
Old 02-11-2009, 06:33 AM   #4
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
are you trying to sync both ways from what you have shown below it looks like you ran the command.

Code:
rsync -avz vjs@fedora7:/opt/pit kally
instead of

Code:
rsync -avz kally vjs@fedora7:/opt/pit
because it was pit that was transfered.

the general principal with rsync is

Code:
rsync -options <source> <destination>
 
Old 02-11-2009, 07:00 AM   #5
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
I am confused !!!

Lets make it more clear,
I have Ubuntu and Fedora Machine.
On Ubuntu I have file at /opt/linux and on fedora I have same file as /opt/linux.

I went to ubuntu machine:
And edited

Code:
#echo "hello" > linux
Now Help me where Should I run rsync on Ubuntu or Fedora?
 
Old 02-11-2009, 07:14 AM   #6
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Its Working fine now.
I was mistaken at running command and now its working.
How can I proceed with ssh without providing password.
I followed http://troy.jdmz.net/rsync/index.html link but again it is asking for password.
Any idea why its behaving so?
I read the troubleshooting colum too but that dint help.

Pls Help
 
Old 02-11-2009, 07:23 AM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2beta2 on Lenovo Thinkpad W520
Posts: 6,776

Rep: Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115Reputation: 2115
New issue => new thread
 
Old 02-11-2009, 07:31 AM   #8
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
if I am not wrong RSYNC with SSH do come under "How to RSync"
I could have asked for number of Questions related to RSYNC at single shot but I need to understand if I am wrong at my steps.Now as I am having rsync working I need a script for rsync without password.
So i dont think that would make any difference following up till my rsync gets working to the fullest.

Hope you will understand.
 
Old 02-11-2009, 09:44 AM   #9
esaym
Member
 
Registered: Nov 2006
Distribution: Lots of Debian
Posts: 165

Rep: Reputation: 32
For password-less ssh log ins you must first create your ssh key for your local machine:

Code:
ssh-keygen -t rsa
Don't enter a password for it, just press enter a few times

Then upload the contents of the file /home/*user*/.ssh/id_rsa.pub to the file /home/*user*/.ssh/authorized_keys on the remote host (or /root/.ssh/authorized_keys for root log in)

Debian distros come with a nice tool to upload the key to the remote host:
Code:
ssh-copy-id -i ~/.ssh/id_rsa.pub username@remotehost
Here is a script I use to back up a box on my lan with:

Code:
rsync -av --delete-before --stats --progress --rsh='ssh -c arcfour -p22' root@10.36.39.1:/ /home/storage/BackUp/ --exclude="/proc/" --exclude="/lost+found/"  --exclude="/mnt/" --exclude="/dev/"
This connects to the server 10.36.39.1 with ssh using arcfour compression (faster) on port 22. It copies / from the whole server into the folder /home/storage/BackUp/ on my local machine.

Please be very careful with the "--delete-before" option. If you get mixed up, it can delete your whole hard drive. Before using --delete-before, run rsync with the -n option for a dry run that won't modify or transfer anything so you can see what will happen.

man rsync:
http://www.manpagez.com/man/1/rsync/

Last edited by esaym; 02-11-2009 at 09:49 AM.
 
Old 02-11-2009, 09:51 AM   #10
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.1
Posts: 1,075

Rep: Reputation: 189Reputation: 189
edit: previous poster beat me to the punch, with similar instructions - no need to muddy the waters.

cheers,

Last edited by mrclisdue; 02-11-2009 at 09:52 AM.
 
Old 02-12-2009, 12:08 AM   #11
Mountain
Member
 
Registered: Nov 2007
Location: A place with no mountains
Distribution: Kubuntu, sidux, openSUSE
Posts: 214

Rep: Reputation: 33
I'm interested in this topic too. However, my question is how to set this up so that rsync doesn't don't need to log in as root to do the backup.

(BTW, I'm actually using dervish, which uses rsync.)

I made /root/.ssh/authorize_keys and I have it working, but now I want to get the backup working without the root login.

Thanks for any help.
 
Old 02-12-2009, 11:37 AM   #12
esaym
Member
 
Registered: Nov 2006
Distribution: Lots of Debian
Posts: 165

Rep: Reputation: 32
Quote:
Originally Posted by Mountain View Post
I'm interested in this topic too. However, my question is how to set this up so that rsync doesn't don't need to log in as root to do the backup.

(BTW, I'm actually using dervish, which uses rsync.)

I made /root/.ssh/authorize_keys and I have it working, but now I want to get the backup working without the root login.

Thanks for any help.
Just ssh as a different user. In my example above instead of root@10.36.39.1, just change the user: someuser@10.36.39.1

Of course you would also have to add your id_rsa.pub key to /home/someuser/.ssh/authorize_keys

And of course if you don't log in as root, you might not be able to get access to some files...

Last edited by esaym; 02-12-2009 at 11:55 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with rsync ryanlum Linux - General 6 09-16-2007 10:51 PM
More Rsync help please wh33t Linux - Software 4 09-06-2007 01:41 PM
Help with rsync Goria Debian 2 12-02-2006 11:49 AM
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 01:10 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 03:49 PM


All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration