LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-17-2008, 12:56 AM   #1
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Rep: Reputation: 0
Rsync Woes


I'm still getting used to Linux. I've got Ubuntu 8.04 on two machines: 1) A debranded HP Pavilion with an AMD Athlon 64 dual core 3800 and 1 GB of RAM
2) An HP Pavilion Pentium III with 256 MB of RAM

I've successfully copied files from one directory to another on the same machine. Now I want to get the knack of copying files from one machine to the other. I'm doing something wrong with the syntax.

The Athlon Linux machine is named tom-desktop while the Pentium III machine is named toms-jukebox.

I tried to copy from the Athlon machine to the Pentium III. So I'm on the Athlon machine on the command line in /home/tom/Documents and I want to copy the file transferthis.odt to the Pentium III. I type:

Quote:
rsync transferthis.odt toms-jukebox
The command runs without a squawk, but then I can't find it on the Pentium III. So I decide to specify a directory. I type:

Quote:
rsync transferthis.odt toms-jukebox/home/tom/Documents
Linux doesn't like that. I get an error saying that no such directory exists. The user name and password on the Pentium III is the same as the other, btw.

I obviously don't get Linux syntax yet. I would have thought it would be [machine name]/whatever/directories, but it's not.

Does someone know the syntax I should be using? Under networking I found some IP numbers. Should I be using those instead? Also, do I need to designate a directory as a shared one like you do in Windows networking?

I'm confused. If someone could clue me in and maybe point me to a page that could help me understand Linux syntax I'd be very grateful. I've googled and found numerous Linux networking pages, but haven't been able to find one that explains the command line syntax of rsync-ing from one machine to another and whether you have to share a resource first.
 
Old 06-17-2008, 01:28 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
From man rsync

Quote:
Access via remote shell:
Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOSTEST
Try

Code:
rsync transferthis.odt toms-jukebox:/home/tom/Documents
Note the colon
 
Old 06-17-2008, 04:33 AM   #3
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks for the help. I believe that code is probably correct. However, it didn't work. Here's what I got in response to that code:

Quote:
ssh: toms-jukebox: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(454) [sender=2.6.9]
Maybe toms-jukebox has to somehow be put on the network as a shared resource? Or perhaps I have to give my login on the Athlon Linux machine ownership to toms-jukebox or file write permissions to that computer?
 
Old 06-17-2008, 05:39 AM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Perhaps you don't have the name in hosts or aren't running a DNS. Substitute its IP, so something like

Code:
rsync transferthis.odt 192.168.1.1:/home/tom/Documents
 
Old 06-17-2008, 05:41 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Try using the IP address of the system.
This error is due to the fact that hosts file does not have the entries to resolve the name tom-jukebox to its IP address.
 
Old 06-17-2008, 05:48 AM   #6
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
To clarify, on the machine that isn't toms-jukebox, put an entry in /etc/hosts at the end of the file like

1.2.3.4 toms-jukebox

replacing 1.2.3.4 with the IP of toms-jukebox.

This will allow you to refer to toms-jukebox by name from this machine
 
Old 06-17-2008, 02:30 PM   #7
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Many thanks for the help. I feel I'm close, but I'm still not having any luck. Here's what I did:

Quote:
rsync transferthis.odt 192.168.0.102:/home/tom/Documents
The result was:
Quote:
ssh: connect to host 192.168.0.102 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(454) [sender=2.6.9]
I thought I had the IP right, but maybe I have it wrong. I've looked around in the networking components on both computers. In many cases I've found IP addresses that are the same on both machines. That's true if I go:

Quote:
System ===> Administration ===> Network
I unlock it with my password, click on the DNS tab. I get the same result on both machines: 192.168.0.1. So it can't be that since it's not unique to a machine. It's a similar result if I click on the Hosts tab. On the Athlon machine I get:
Quote:
IP Address = 127.0.0.1, Alias = localhost
IP Address = 127.0.1.1, Alias = tom-desktop
On the Pentium III, the result of clicking the Hosts tab is almost identical:

Quote:
IP Address = 127.0.0.1, Alias = localhost
IP Address = 127.0.1.1, Alias = toms-jukebox.ThomasOwenM
These aren't IPs unique per machine and therefore cannot be the right ones, right? Then I did what I thought for sure yielded the right answer. I went: System ===> Administration ===> Network Tools, and clicked on Tracerroute. I put in what seems to me is the parent IP for both machines: 192.168.0.1. On the Athlon machine, the first result that pops up is:
Quote:
Hostname = tom-desktop.local, IP = 192.168.0.103.
On the Pentium III, the result is:
Quote:
Hostname = toms-jukebox.local, IP = 192.168.0.102
I figure, Cool, "192.168.0.102" is the Pentium III's unique IP, so I plug that into the command. However, as you can see, it didn't work. I must still either have the IP wrong or messed up the syntax somehow. Where did I go wrong? Is the tracerroute not the correct way to get each machine's unique IP?

Btw, I'm going Applications ===> System Tools ===> Konsole to use the command line. That way I can cut and paste the result. I'd doubt doing it this way is any different from going Ctrl+Alt+F2 to use the command line, but if I should be doing it the other way, please let me know.

Last edited by Tom_ZeCat; 06-17-2008 at 02:32 PM. Reason: forgot a detail
 
Old 06-17-2008, 03:08 PM   #8
rtspitz
Member
 
Registered: Jan 2005
Location: germany
Distribution: suse, opensuse, debian, others for testing
Posts: 307

Rep: Reputation: 32
Code:
rsync -av transferthis.odt valid_username_on_dest@IP_OF_DESTINATION_MACHINE:/path/to/folder
 
Old 06-18-2008, 03:09 AM   #9
Tom_ZeCat
LQ Newbie
 
Registered: May 2008
Location: Omaha, Nebraska
Distribution: Ubuntu
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks for the help. Unfortunately, I'm still struggling here. I carefully used that syntax from the last post, but my rsync was refused. I tried it both ways to no avail. From the Athlon machine, I tried:

Quote:
rsync -av transferthisfile.odt tom@192.168.0.102:/home/tom/Documents
I get the same errors as before, saying the connection was refused. From the Pentium III I tried:

Quote:
rsync -av fromp3.odt tom@192.168.0.103:/home/tom/Documents
In each case I used "pwd" and "ls" to verify that I was indeed in the /home/tom/Documents directory and that the files to be transferred were there. So very frustrating.

Did I do the right thing as I described in my previous post to figure out each machine's IP? I used a tracerroute.

I know on Windows machines you can run into this kind of trouble if one machine doesn't have permission to access a directory on another PC. The solution is to then go in as the administrator and grant permission. Is there a similar type of thing in Linux? I thought I went in and granted read and write permissions to other users, but maybe I didn't do it right.

This is a simple wired network with a D-Link ethernet router. The Athlon Linux machine and the Athlon Windows machine are both hooked up to the network via about 7-foot cat 5 cables. The Pentium III Linux machine is hooked up via a 50 ft cat 6 cable.

Is there a good Linux tutorial or wizard that can get me up to speed on Linux networking? Something that starts from square one? I need something like that because I'm obviously not grasping this well enough. If there's a book I should read, I don't mind going to Amazon and ordering it.
 
Old 06-18-2008, 03:24 AM   #10
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Could be a firewall issue. Do you know what ports are open on each machine? Maybe add --port=22 (although I'd have guessed that was the default)
 
Old 06-18-2008, 03:29 AM   #11
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
The other thing to try may be to add "-e ssh" as an option. What I'm trying to do os force port 22 - the rsync daemon uses 873, but I don't know about the non daemon version

Bill
 
Old 06-18-2008, 03:43 AM   #12
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If you end up using rsync between machines a lot, it's worth looking into the daemonised version. rsyncd.conf (see man rsyncd.conf) allows you to define modules (similar to exports in NFS) that you can pull from or push to. You'll see these in man rsync where the usage (to pull) is

Code:
rsync host::modname/dir/file /dest
and a module definition may look like

Code:
[src]
        path = /usr/src
        comment = source tarballs
        use chroot = no
        read only = no
        uid = root
        gid = root

Last edited by billymayday; 06-18-2008 at 03:46 AM.
 
Old 06-18-2008, 03:57 AM   #13
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
Instead of rsync you can also use scp to copy the contents to destination just in case rsync is not working or you are not able to get it right. ( later option seems to be more appropriate though ).
Scp can be easy as well. Similar to cp command give the source and destination. Thats it.

scp source user@destination-ip:/path/to/folder
 
Old 06-18-2008, 06:53 PM   #14
kenoshi
Member
 
Registered: Sep 2007
Location: SF Bay Area, CA
Distribution: CentOS, SLES 10+, RHEL 3+, Debian Sarge
Posts: 159

Rep: Reputation: 32
Most Linux installs leave rsync daemon off by default. Not sure about workstation distros, I work with mostly CentOS and RH5.

Rule of thumb is always use ssh

e.g. rsync -av -e ssh filename machine:/directory/

Hope this helps.
 
Old 06-18-2008, 08:57 PM   #15
sabumd
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
rsync requires rsh, you have to install rsh first before trying rsync.
If you just want to copy files across use scp.
 
  


Reply

Tags
basics, files, linux, network, rsync, transfer


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
cp or rsync szim90 Linux - Software 2 06-17-2007 12:11 AM
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM
Rsync woes Swakoo Linux - Networking 2 08-22-2005 10:52 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM
rsync becks.lin Linux - Software 6 03-22-2004 07:45 PM


All times are GMT -5. The time now is 08:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration