Rsync installed but still getting an error command not found
I am trying to sync a local folder to a remote server using a non standard port and my rsync command is as follows:
rsync -avz ~/Research/Folder1/folder2 -e "ssh -p 3345" [email protected]:/home/reusr/folder1/folder2
I am getting the following errors:
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.3]
and when I run rsync --version
I get
rsync version 3.1.3 protocol version 31
I am not sure why the command not found
or the subsequent errors are happening.
I am using OSX Maojave as my local machine and a Debian server as my remote machine.
You local rsync needs to start a remote rsync from the SSH on the remote server but is unable to find it since it's probably not in its path.
That's where the "command not found" error comes from (i.e. this signifies your local rsync cannot find the remote rsync executable from the SSH session on the remote machine).
You need to find out the path of rsync on the remote server and make that part of your rsync parameters. The parameter you need to add is:
--rsync-path=/path/to/remote/rsync
Where /path/to/remote/rsync is the location on the remote server of the rsync command. Since your remote rsync server runs on Debian, this will probably be /usr/bin/rsync
So your rsync command becomes:
rsync -avz ~/Research/Folder1/folder2 -e "ssh -p 3345" --rsync-path=/path/to/remote/rsync [email protected]:/home/reusr/folder1/folder2
Make sure rsync
is also installed on the remote machine you are trying to access. In my case, I was getting this error on the local machine on which it was installed, because rsync
wasn’t installed on the remote server.