I want to run rync to a remote server which has an uncleaned shell. If someone tries to connect it via ssh shell, it'll show some warnings. Due to this issue I couldn't able to copy files.

protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(178) [sender=3.1.2]

Question 1:

Is there any way to run the rsync on an uncleaned shell?

Then I tried with a cleaned shell. I have removed all the warning messages and then verified with rsh command.

rsh -i key -p 2022 remotehost@user > output

There is no data and its size was 0.

Then I tried to do the sync, now im getting the below error.

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.2]

Question 2:

After cleanup, still getting error, what can be the reason?

rsync command

rsync -avz --progress -e "ssh -p 2022 -i mykey.pem" /tmp/test/ admin@

Can anyone help me on this?

I forgot to mention this earlier. I have enabled SSH session recording.

  • You probably have something in the .bashrc that outputs something. Why are you testing with rsh and then using ssh for rsync?! – wurtel Jul 20 '18 at 11:30

Is there a reason why you first mention the command "rsh" and later the command is "ssh"?

This command is not supposed to produce an empty file, it should start an interactive shell and wait for input.

ssh -i key -p 2022 remotehost@user > output

It would seem your login shell immediately terminates, this is supported by the message 0 bytes received. Did you place an "exit" somewhere while you removed the output from the shell?

  • I have enabled SSH session recording, I got to know that if session recording enabled, we can't use scp,rsync – Bhuvanesh Jul 19 '18 at 4:48
  • What happens if you use the command ssh -p 2022 -i mykey.pem admin@ pwd? Does it display the home directory of the user admin? – RalfFriedl Jul 19 '18 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.