LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-20-2005, 02:50 PM   #1
osio
Member
 
Registered: Jun 2005
Posts: 70

Rep: Reputation: 15
rsync -e ssh error protocol incompatibility


I'm trying to sync my remote web folder with my local one
$ rsync -navz -e ssh remoteuser@remotehost:www/domain /var/www/html

I am prompted for the password.
remoteuser@remotehost's password:
After I enter the password I get

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


$ which ssh returns /usr/bin/ssh
ssh is working

My rsync version is 2.6.2-0.
My kernel is 2.6.5-1.358 with Fedora Core 2.
My host's remote kernel is 2.4.29-2-s5

What can I do?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 07-20-2005, 03:02 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
There is probably a script producing output in your .bash_profile or similar file (fortune, perhaps?).

Try this as a test:
Code:
ssh remoteuser@remotehost echo 2>/dev/null
You should see NO results after entering the password.
 
Old 07-20-2005, 03:10 PM   #3
osio
Member
 
Registered: Jun 2005
Posts: 70

Original Poster
Rep: Reputation: 15
Well, no, there is no output when I do that at shell.
If I do
$ rsync -navz -e ssh remoteuser@remotehost:www/domain 2>/dev/null /var/www/html
I am prompted for the password, but when I enter it I am back to my local shell, as if the connection were instantaneously dropped!
 
Old 07-20-2005, 03:16 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
2>/dev/null would supress any rsync errors.
 
Old 07-20-2005, 03:26 PM   #5
osio
Member
 
Registered: Jun 2005
Posts: 70

Original Poster
Rep: Reputation: 15
Matir,
Thank you, but I can't connect nevertheless.
I read .bash_profile and even in my extreme ignorance I don't see anything bizarre.
The same for .bashrc

P.S.
Not that it adds to the description of the problem, but I used the last putty version from a Windows box and there was no incompatibility. But I can only afford to do this in Linux.
 
Old 07-21-2005, 05:42 AM   #6
osio
Member
 
Registered: Jun 2005
Posts: 70

Original Poster
Rep: Reputation: 15
My host suppressed the welcome message that interfered with rsync by changing my shell at the server.
Done!
 
Old 08-03-2005, 02:44 PM   #7
plaus
LQ Newbie
 
Registered: Aug 2005
Posts: 1

Rep: Reputation: 0
also...

It should be noted that if you are using passwordless ssh (via certificate), there may be further issues to look at. If the backup account's authorized_keys file (in ~/.ssh) has more than just the ssh-rsa or ssh-dsa line, that is, if it contains a ``command="rsync --server --daemon'' prefix to the ssh-rsa / ssh-dsa line, that could very well be triggering the message, "protocol version mismatch - is your shell clean?"

I've been using bontmia for rsync backups, and it is a great script. However, it seems to expect a clean authorized_keys file, without a ``command=...'', and doesn't say so in the instructions.

Just thought I'd point that out.

-plaus
 
Old 08-18-2005, 10:50 AM   #8
shahhe
Member
 
Registered: Nov 2003
Location: Chicago
Distribution: RHEL 5.4 on HP servers
Posts: 44

Rep: Reputation: 15
Sorry if this was posted twice. When I clicked on "Submit Reply" something went wrong and my browser crashed.

I am having similar problem.
I have 2 system that act as firewalls, one is the backup of another so they are identical.

I use command="rsync --server --daemon ." in the authorized_keys2 file and it works without any problem.

I am trying to do the same with my devlopment and production web server which have different versions of rsync. If I remove
command="...." from the ssh key, the rsync from develpoment to production works. When I add command="rsync --server --daemon ." to the file I get following error:

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

Do you have to have same version of rsync in order to use server protocol?

Following command creates empty file so I do not think the startup file is problem.

ssh -i ~/.ssh/rsync.dsa root@prodsys true > /tmp/x

Development system is using:
# rsync -h
rsync version 2.5.6 protocol version 26

Production is using:
# rsync -h
rsync version 2.6.2 protocol version 28

What is the protocol version is that a problem?

On development system I run following command:

# rsync -rLptgz -e "/usr/bin/ssh -i ~/.ssh/rsync.dsa" /var/www root@prodsys:/var/www

On production system I have command="rsync --server --daemon ." in the authorized_keys2 file.
 
Old 04-21-2008, 08:37 AM   #9
geeksedition
LQ Newbie
 
Registered: Apr 2008
Location: Toronto
Distribution: RadHat, Ubuntu, SuSE
Posts: 9

Rep: Reputation: 0
Had the same prob, here is what happened

Hey all,

I found this thread here looking for the same problem. In reading this I had an epiphany. I asked myself what has changed since this was working before... what an odd thing to do :P

I use rsync with ssh and authorized key files for auto login to mirror a remote system to the local one.

The only change I made was on my .bashrc on the remote end I added in some commands to show file system usage. do a du -f and a tail of the log on login for conveniences.

My assumption here is that when rsync executes the ssh to connect it received 'junk'. Once I removed the extra output from the .bashrc file on the remote end, it worked just fine.

SO check your remote end for .profile, .bashrc, .bash_profile etc.... any scripts running that add extra output on login.

Just ask for any questions!

Cheers,
#Ian.
 
Old 07-09-2009, 02:38 AM   #10
mohammednv
LQ Newbie
 
Registered: Mar 2007
Posts: 22

Rep: Reputation: 20
I'm getting this "protocol version mismatch" error even when I tried to rsync files on the same server.

---------------------
[root@ ~]# rsync -av /home/mohammed/scptest mohammed@localhost:./test/
mohammed@localhost's password:
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]
[root@ ~]#
---------------------

rsync version 3.0.6 protocol version 30
CentOS release 5 (Final)


I checked .bash* files, I don't see any junk inputs there.

Any ideas??
 
Old 07-09-2009, 03:51 AM   #11
mohammednv
LQ Newbie
 
Registered: Mar 2007
Posts: 22

Rep: Reputation: 20
Got an answer <but yet to find a permanent fix for me>

For my customized setup, I had added two commands to /etc/bashrc which apparently confused rysnc. Rsync is working without my additional lines. It looks like any modifications to /etc/bashrc hurts rsync.

The problem is, I can't exclude those two commands from executing when I user logs in. Since they are MUST RUN commands, I am searching for alternatives.

I welcome any suggestions on this.

Thanks,
Mohammed
 
Old 07-09-2009, 04:14 AM   #12
mohammednv
LQ Newbie
 
Registered: Mar 2007
Posts: 22

Rep: Reputation: 20
Got through when I added my commands to /etc/profile instead of /etc/bashrc. As far I checked, it's working fine. I'll let you know if I find any issues.

~mohammed
 
3 members found this post helpful.
Old 11-21-2012, 12:59 PM   #13
joncaplan
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
Confirmed: .bashrc output causing remote connect problem

Thanks mohammednv!

Removing output from my remote host's .bashrc file solved my issues connecting to the remote host via rsync, sftp, and scp. (I had a informational echo statement, which is now removed.)

-Jon
 
Old 11-06-2019, 04:35 PM   #14
anselmobd
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
Thumbs up My problem was in .bashrc

Quote:
Originally Posted by mohammednv View Post
Got through when I added my commands to /etc/profile instead of /etc/bashrc. As far I checked, it's working fine. I'll let you know if I find any issues.

~mohammed
Thank you mohammednv!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync->ssh port lackluster Linux - Software 2 05-27-2007 08:42 PM
rsync and ssh? IchBin Linux - Newbie 4 02-13-2005 03:41 PM
rsync and ssh port ohcarol Linux - Software 2 12-22-2004 10:29 AM
Rsync vs ssh satimis Linux - Software 7 04-04-2004 06:58 AM
Rsync and SSH Phaethar Linux - Software 3 03-22-2004 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration