Possible Duplicate:
protocol version mismatch — is your shell clean?

I am trying to backup my linux webserver to our local windows sbs 2003 server in the office. I have set up ssh and cwrsync on the windows server and have confirmed that the linux server can reach the windows server via the command:

ssh RemoteUser@xxx.xxx.xxx.xxx

It asks for a password and connects fine. However when I run this command to start the backup:

rsync -avz -e ssh home/account/public_html/some/small/directory/ remote_user@xxx.xxx.xxx.xxx:/cygdrive/c/backup/destination/directory/

I get this error after entering the password:

protocol version mismatch -- is your shell clean?

and then it dies.

What does this mean, and how do I fix it?

  • Not a programming question. – unwind Feb 18 '11 at 13:18

The error protocol version mismatch -- is your shell clean? means that the local rsync gets some invalid data from the remote machine which isn't part of the rsync protocol.

This is normally caused by automatic shell login messages like the message of the day (/etc/motd), therefore the is your shell clean? part.

Log into this machine manually and look if you get any such message. In order to rsync to work you should only get the remote command line prompt. If you get a message try to disable it. Look at your shell config files (e.g. ~/.bashrc, /etc/bash.bashrc for the bash shell) if they contain any command producing this output.


One of your login scripts (.bashrc/.cshrc/etc.) may be outputting data to the terminal when it shouldn't be. This is causing ssh to error when it is connecting and getting ready to copy as it starts receiving extra data it doesn't expect. Remove output that is generated in the startup scripts.

You can check if your terminal is interactive and only output text by using the following code in a bashrc. Something equivalent exists for other shells as well:

if shopt -q login_shell; then
    [any code that outputs text here]

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