Bug 152866 - cannot connect when ssh ControlMaster is used
Summary: cannot connect when ssh ControlMaster is used
Status: RESOLVED DUPLICATE of bug 100815
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: sftp (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Dawit Alemayehu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-25 13:08 UTC by Gokdeniz Karadag
Modified: 2009-03-08 08:10 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gokdeniz Karadag 2007-11-25 13:08:21 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Gentoo Packages
Compiler:          gcc 4.1.2 
OS:                Linux

When ssh's ControlMaster feature is being used konqueror cannot connect with "sftp://" urls.

If I start ssh connection on the commandline with openssh, control socket gets created. Konqueror cannot use it and gives error message "unexpected sftp error: 2  --- error encountered while talking to ssh"

If konqueror starts the connection itself, the control socket is created correctly. And other ssh commands from command line work, BUT other kde programs using sftp:// urls do not work. So I think the problem is in kio_sftp.

If no ControlMaster is used, everything works properly.
Comment 1 Albert Astals Cid 2008-12-23 20:12:23 UTC
How does one enable ControlMaster?
Comment 2 Joshua T. Corbin 2008-12-23 20:22:04 UTC
A basic ~/.ssh/config that will use ControlMaster:
  Host *
    ControlPath ~/.ssh/master_%r@%h:%p
    ControlMaster auto

After enabling ControlMaster, run from a shell:
  ssh -MNf host

This will start the master process, verify that the socket exists in ~/.ssh .

Now trying to open sftp://host in kio will fail, for me it usually hangs and I end up killing the kio process, but there is some sort of a timeout if you're patient enough.
Comment 3 Joshua T. Corbin 2008-12-23 20:23:37 UTC
Forgot to mention, this impacts latest KDE 4.2 beta (latest as kdebase=4:4.1.85-0ubuntu1~intrepid1~ppa1).
Comment 4 Albert Astals Cid 2008-12-27 22:31:45 UTC
The problem is that when doing 
ssh -p 22 -o ForwardX11=no -o ForwardAgent=no -o Protocol=2 -e none -l username -v host -s sftp
there is no debug line you can use to detect you've been successfully connected if you are using a master process. 

When not using a master process we use the "Authentication succeeded" token to know we are inside the machine.

If you have any idea on how to detect it it's welcome.

Also someone really interested in making this work (that is, not me) could contact the openssh guys and ask them for input on the issue or ask them to add a debug message saying we got logged in.
Comment 5 Anderson Medeiros Gomes 2008-12-28 17:17:56 UTC
I don't care if fish:// explicitly disables connection multiplexing by issuing "ssh -o ControlPath=none -o ControlMaster=no <...>". This is a better behavior than the inability to establish connections...

In order to do it, fish:// also needs to ensure SSH supports "ControlPath" option in command line. Connection multiplexing was implemented in SSH 3.9 (http://www.openssh.com/txt/release-3.9), so a simple version check is enough: "ssh -V".

---------------------------

If KDE developers wants to use connection multiplexing in fish://, SSH 5.1 has the "-O check" option (unfortunately, I couldn't see which version implemented this feature first). It can check if there is a master process running and report the result in its exit code:

$ ssh -O check 10.100.0.1 ; echo $?
Control socket connect(/home/amg1127/.ssh/amg1127@10.100.0.1:22): Connection refused
255

$ ssh -O check 10.100.0.2 ; echo $?
Master running (pid=22271)
0

$ ssh -O check 10.100.0.3 ; echo $?
Control socket connect(/home/amg1127/.ssh/amg1127@10.100.0.3:22): No such file or directory
255

Comment 6 Dawit Alemayehu 2009-03-08 08:10:18 UTC

*** This bug has been marked as a duplicate of bug 100815 ***