Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rsync and sftp doesn't work when remote host uses fish shell #3473

Closed
pawlosck opened this issue Oct 18, 2016 · 3 comments
Closed

Rsync and sftp doesn't work when remote host uses fish shell #3473

pawlosck opened this issue Oct 18, 2016 · 3 comments
Labels

Comments

@pawlosck
Copy link

OS: Debian Jessie
fish: 2.2.0

OS: Maui Linux
fish: 2.3.1

How to reproduce?

  1. set on remote host any script to run on login (script should print any message on command line)
  2. Try to login to remote host via sftp -> Fail
  3. Try to sync any dir via rsync. Rsync should use ssh to sync dir on remote host. -> Fail

When remote host uses fish shell, user can't use rsync and sftp (sftp on command line and inside mc). Remote host uses on login script to show some informations.
Link to script: https://blog.pawel.mydevil.net/index.php/2014/02/20/wyswietlanie-danych-przy-logowaniu-skrypt/

I tested on two hosts. First host is Debian Jessie (fish, version 2.2.0) and second is Maui Linux (fish, version 2.3.1).

sftp
sftp root@remoteHost
root@remoteHost's password:
Received message too long 539831597

part of log auth.log
Accepted password for root from localHost port 48460 ssh2
Oct 18 19:18:59 bpi sshd[7502]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 18 19:19:00 bpi sshd[7502]: Received disconnect from localHost: 11: disconnected by user
Oct 18 19:19:00 bpi sshd[7502]: pam_unix(sshd:session): session closed for user root

rsync:
~ $ sudo rsync -av --delete -e ssh /home/pawel pawel@remoteHost:/mnt/backup
[sudo] hasło użytkownika pawel:
pawel@remoteHost'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(176) [sender=3.1.1]

I read manual and Internet and I executed the command
"ssh pawel@RemoteIP /bin/true > out.dat"
file "out.dat" contain result of script runned on login.

When I comment out link to script in file /etc/fish/config.fish, everything works correctly.

@krader1961
Copy link
Contributor

Works for me. This type of failure is usually caused by the shell config files writing to stdout when the session isn't interactive. In the case of fish you should ensure that anything in your ~/.config/fish/config.fish (and scripts it sources) that might write to stdout (or read from stdin but that's less common) is wrapped in a if status --is-interactive ... end block.

@pawlosck
Copy link
Author

Thanks a lot for your help. I put something like this

if status --is-interactive
/path/to/script/which/print/on/console
end

into /etc/fish/config.fish and works perfectly. Script is running only when shell is invoked by user, not by script.
I tryed to put "if" inside script,. but I don't know how to mix bash script and fish script.

@cdluminate
Copy link
Contributor

Why not put this hint to FAQ? I've suffered from this problem for a time, being unable to use rsync with fish shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants