Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

It turns out rsync can't work with a remote server which has a .bashrc file?

At local client i got when run rsync:

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

As suggested here removing the .bashrc on server solved the problem. How to solve it without removing the .bashrc file (temporarily)?

share|improve this question
    
Check if ssh is enabled for that account. –  Lamy Jan 4 '13 at 9:22
    
The below answers are likely incorrect. I recently started getting this error after a routine Ubuntu upgrade, even though nothing changed in my .bashrc files. –  Cerin Feb 19 '13 at 19:30
    
No - if removing the .bashrc file fixes it (as was stated in this question), then the problem is output from the .bashrc. An upgrade could certainly introduce an actual protocol incompatibility, which is an entirely different issue. –  Randall Aug 1 '13 at 16:42
add comment

migrated from stackoverflow.com Aug 23 '11 at 13:24

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 5 down vote accepted

You can run into problems if the .bashrc on the remote server outputs anything to the terminal. Rsync may not expect that and may have problems as a result.

You can fix this by removing any commands in the .bashrc that output text, or by piping any output to /dev/null.

share|improve this answer
    
So how to pipe any output to /dev/null if i can only modify files on client? –  Computist Aug 23 '11 at 15:02
1  
I suppose you could as your system administrator for assistance. You may also be able to modify files on the server in another way, such as FTP or scp. –  Greg Hewgill Aug 23 '11 at 19:37
add comment

The .bashrc is really not the correct place for generating output, as it causes this kind of problem. A lot of people get away with it, though, until they try to run rsync :-)

Any desired output (and the associated logic and commands) should be moved to your .bash_profile (see, e.g., Server Fault question ".profile vs. .bash_profile vs. .bashrc" for further discussion on the differences between the files).

That way, you won't need to sacrifice getting the output when you login, nor deal with making temporary changes to your .bashrc when you want to use rsync.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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