Today I came across a weird problem that I’ve never seen before. While trying to migrate information from one server to another using rsync I get this error:
bash: rsync: command not found
This was the full output:
[firstname.lastname@example.org:~]rsync -avpr -e 'ssh -p 22' email@example.com:/home/company/public_html/* /home/company/public_html/ bash: rsync: command not found rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: remote command not found (code 127) at io.c(600) [receiver=3.0.6]
The problem was on the remote host, who didn’t had rsync installed.
How can I fix bash: rsync: command not found error?
Install rsync on the remote host to fix this issue.
On Ubuntu/Debian operating systems:
apt-get install rsync
On CentOS/RHEL operating systems:
yum install rsync
[firstname.lastname@example.org ~]# yum install rsync Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.xfree.com.ar * extras: centos.xfree.com.ar * updates: centos.xfree.com.ar Excluding Packages in global exclude list Finished Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package rsync.i386 0:3.0.6-6.el5_11 set to be updated --> Finished Dependency Resolution Installing: rsync i386 3.0.6-6.el5_11 updates 338 k Total download size: 338 k Is this ok [y/N]: y Downloading Packages: rsync-3.0.6-6.el5_11.i386.rpm | 338 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : rsync 1/1 Installed: rsync.i386 0:3.0.6-6.el5_11 Complete!
Then run rsync again in your new server to transfer the files, it should work without issues.
[email@example.com:~]rsync -avpr -e 'ssh -p 22' firstname.lastname@example.org:/home/company/public_html/* /home/company/public_html/ receiving incremental file list 400.shtml 401.shtml 403.shtml 404.shtml 500.shtml
That’s all, rsync is working again and your bash: rsync: command not found should be gone.