-   Linux - Newbie (
-   -   Rsync Woes (

Tom_ZeCat 06-17-2008 12:56 AM

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:


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:


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.

billymayday 06-17-2008 01:28 AM

From man rsync


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


rsync transferthis.odt toms-jukebox:/home/tom/Documents
Note the colon

Tom_ZeCat 06-17-2008 04:33 AM

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:


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?

billymayday 06-17-2008 05:39 AM

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


rsync transferthis.odt

linuxlover.chaitanya 06-17-2008 05:41 AM

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.

billymayday 06-17-2008 05:48 AM

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

replacing with the IP of toms-jukebox.

This will allow you to refer to toms-jukebox by name from this machine

Tom_ZeCat 06-17-2008 02:30 PM

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


rsync transferthis.odt
The result was:

ssh: connect to host 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:


System ===> Administration ===> Network
I unlock it with my password, click on the DNS tab. I get the same result on both machines: 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:

IP Address =, Alias = localhost
IP Address =, Alias = tom-desktop
On the Pentium III, the result of clicking the Hosts tab is almost identical:


IP Address =, Alias = localhost
IP Address =, 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: On the Athlon machine, the first result that pops up is:

Hostname = tom-desktop.local, IP =
On the Pentium III, the result is:

Hostname = toms-jukebox.local, IP =
I figure, Cool, "" 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.

rtspitz 06-17-2008 03:08 PM


rsync -av transferthis.odt valid_username_on_dest@IP_OF_DESTINATION_MACHINE:/path/to/folder

Tom_ZeCat 06-18-2008 03:09 AM

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:


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


rsync -av fromp3.odt tom@
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.

billymayday 06-18-2008 03:24 AM

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)

billymayday 06-18-2008 03:29 AM

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


billymayday 06-18-2008 03:43 AM

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


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


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

linuxlover.chaitanya 06-18-2008 03:57 AM

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

kenoshi 06-18-2008 06:53 PM

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.

sabumd 06-18-2008 08:57 PM

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

All times are GMT -5. The time now is 09:50 PM.