LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync problem: command not found (https://www.linuxquestions.org/questions/linux-software-2/rsync-problem-command-not-found-658831/)

j_70 07-28-2008 01:49 PM

Rsync problem: command not found
 
I am trying to run a simple rsync job on RHES4 but keep getting a command not found error. The job is this:

rsync -r <my user>@<my server>:/home/myuser/ /batch/

This is the error message:

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


I have tried feeding it the rsync path with --rsync-path=/usr/bin/rsync but still not luck. Ideas?

trickykid 07-28-2008 02:13 PM

How about just placing the full path to the executable:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

And you might want to put /usr/bin in your users path, this is a common place for most executables you'll end up running anyways. I find it strange it's not already in your path, unless you don't have rsync installed. ;)

AlucardZero 07-28-2008 02:17 PM

that looks like rsync is not installed on the remote server. is it?

trickykid 07-28-2008 02:27 PM

Quote:

Originally Posted by AlucardZero (Post 3228978)
that looks like rsync is not installed on the remote server. is it?

To my knowledge rsync doesn't need to be on the remote machine since by default it will use the ssh protocol.

j_70 07-28-2008 02:33 PM

I tried this but I get the same error:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


Rsync is on my server:
which rsync
/usr/bin/rsync


It is not on the remote server, but as trickykid stated, my understanding was that it did not need to be.

trickykid 07-28-2008 02:37 PM

Quote:

Originally Posted by j_70 (Post 3228993)
I tried this but I get the same error:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


Rsync is on my server:
which rsync
/usr/bin/rsync


It is not on the remote server, but as trickykid stated, my understanding was that it did not need to be.

Maybe it's trying to use rsync on the remote server as well. Try adding a -e ssh in the command like this:

/usr/bin/rsync -r -e ssh <my user>@<my server>:/home/myuser/ /batch/

j_70 07-28-2008 02:41 PM

Hmmm. Same error. Maybe it does need to be installed on the remote server?

trickykid 07-28-2008 02:54 PM

Quote:

Originally Posted by j_70 (Post 3229003)
Hmmm. Same error. Maybe it does need to be installed on the remote server?

Hmm.. I just tested without and got the same error. I'm guessing rsync is needed on remote destination machine in order to carry out the copy. I could have sworn in the past or previous versions it wasn't necessary, but then again, I always have rsync installed on all Linux machines I administer. ;)

j_70 07-28-2008 02:58 PM

Seems to be. This is going to Windowz over SSH so I was hoping that I could just use rsync to copy only new files over. Does SCP have an rsync-like option to only copy new files?

trickykid 07-28-2008 03:01 PM

Wait, you're trying to go from Linux to Windows? SCP does not to my knowledge have rsync type capabilities and will overwrite existing files, etc.

j_70 07-28-2008 03:13 PM

Yes (unfortunately) Linux -> Windoze. I read some information on the Samba / rsync list that this was possible, if ssh was set up. Apparently not, however. Maybe rdiff will work.

trickykid 07-28-2008 04:00 PM

Quote:

Originally Posted by j_70 (Post 3229029)
Yes (unfortunately) Linux -> Windoze. I read some information on the Samba / rsync list that this was possible, if ssh was set up. Apparently not, however. Maybe rdiff will work.

The only time I've seen rsync work with Windows and or going to Windows is when I had sshd running in a cygwin instance. There might be a Windows SSH daemon but I've never dealt with it directly.

chrism01 07-28-2008 08:27 PM

This looks like what you want:
http://www.captain.at/howto-rsync-linux-windows.php
http://www.brentnorris.net/rsyncntdoc.html

kenoshi 07-29-2008 11:08 AM

Just install cygwin on your windows box. Make sure the following are installed:

- All packages in admin
- unzip/zip from archive
- select vim in editors
- in Net, select openssh client/server, then rsync
- everything else default

Once cygwin is finished, open the cygwin bash shell, and run:

ssh-host-config

Say yes to everything and follow instructions to start the service.

Voila, you are all set. If you still get the same error, make sure you specify where rsync is remotely with the following option:

--rsync-path=<path to rsync on windows box>

Hope this helps.

alberto56 11-26-2013 09:56 AM

In my case I was trying to rsync from Mac OS to CentOS. rsync has to be installed on the remote box, but it is expected to be at /usr/sbin/rsync instead of /usr/bin/rsync. I just created a symlink on my remote machine:

ln -s /usr/bin/rsync /usr/sbin/rsync

Now rsync works


All times are GMT -5. The time now is 06:08 AM.