I'm using a "rocket-science" bash script to quickly deploy a WordPress code to a shared hosting from my local machine. Everything was working till yesterday. Now I'm just involved in a discussion with the hosting administrators trying to suggest that everything is OK on my end.
Here's the script:
#!/bin/bash
printf "Running gulp\n"
gulp --production
printf "Running rsync\n"
rsync -vzrP --update ~/Code/Project/wp-content/themes/foo-theme mylogin@shared-hosting-server.com:/home/mylogin/domains/example.com/public_html/wp-content/themes/ --delete
To not be prompted about password all the time, I added my key to known_hosts
on server's .ssh
directory. And for months it was working with absolutely no issues. Yesterday I got message that "identification has changed…"
Running rsync
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in /Users/slick/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/slick/.ssh/known_hosts:7
RSA host key for shared-hosting-server.com has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
I solved this by removing suggested line no. 7 from /Users/slick/.ssh/known_hosts
and accepting new key.
but that didn't solve the rsync
problem.
I always get:
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(226) [Receiver=3.1.2]
Please answer my questions or confirm that my way of understanding is correct.
1) Am I right that the issue is caused by the hosting side and on my end everything is OK?
2) Am I right that rsync has to exist on both ends (my local Mac) and shared hosting as well? According to this post – rsync
needs to be on both ends.
3) I can log into the server on remote with no issues ssh -l mylogin shared-hosting-server.com
– it doesn't ask for password so my known_hosts
stuff is setup correctly. On the remote server I typed:
rsync
got
-bash: rsync: command not found
and
which rsync
got
/usr/bin/which: no rsync in
(/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/mylogin/bin)
It means that rsync
does not exist anymore on the hosting or stopped being available to me. Is that the source of the issue?
Thanks for any explanations.
Best Answer
The
rsync
command needs to be installed on both sides of the transfer.You need to make sure it is installed on your hosted server. That is all.