Is it possible to use rsync over sftp (without an ssh shell) ?
- by Tom Feiner
Rsync over ssh, works great every time.
However, trying to rsync to a host which allows only sftp logins, but not ssh logins, provides the following error:
rsync -av /source ssh user@remotehost:/target/
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]
Here's the relevant section from the rsync man page:
This message is usually caused by your startup scripts or
remote shell facility producing
unwanted garbage on the stream that
rsync is using for
its transport. The way to diagnose this problem is to run your
remote shell like this:
ssh remotehost /bin/true > out.dat
then look at out.dat. If everything is working correctly then
out.dat should be a zero length file.
If you are getting the above error
from rsync
then you will probably find that out.dat contains some text or
data. Look at the contents and try to
work out what is producing it. The
most com-
mon cause is incorrectly configured shell startup scripts (such
as .cshrc or .profile) that contain
output statements for non-interactive
logins.
Trying this on my system produced the following in out.dat:
ssh-dummy-shell: Command not allowed.
As I thought, the host is not allowing ssh logins.
The following link shows that it is possible to accomplish this task using fuse with sshfs - however it is extremely slow, and not fit for production use.
Is there any chance of getting rsync sftp to work?