Bug 375732

Summary: Dolphin fails to sftp to Linux box when not a direct connection
Product: [Frameworks and Libraries] kio-extras Reporter: Scott Deagan <scott.deagan>
Component: SFTPAssignee: Plasma Development Mailing List <plasma-devel>
Status: RESOLVED UPSTREAM    
Severity: grave CC: elvis.angelaccio, maiphi.public, nate, wari.wahab
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
URL: https://bugs.libssh.org/T109
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Scott Deagan 2017-01-30 00:59:28 UTC
Using Kubuntu 16.10 with Dolphin 16.04.3.

Cannot use sftp in Dolphin to access a server that has to traverse a hop using ProxyCommand. For example, consider the following ~/.ssh/config entry:

    Host hud
        ServerAliveInterval 60
        HostName 192.168.0.2
        User scott
        IdentityFile ~/.ssh/id_rsa
        ProxyCommand ssh homeserver nc -w100000 %h %p 2> /dev/null

From the terminal:

    ssh hud

works as expected. However, from the Dolphin File Manager:

1. Press CTRL + L to make the address bar editable.
2. In the address bar, enter: sftp://hud

will fail. A red banner appears in Dolphin with the message "Socket error: disconnected". This works on another laptop running Ubuntu 16.10.

The following appears in /var/log/syslog when attempting to sftp://hud from Dolphin:

Jan 30 00:54:40 d2-lin org.kde.kpasswdserver[1323]: kf5.kiod: loadModule "kpasswdserver"
Jan 30 00:54:40 d2-lin org.kde.kpasswdserver[1323]: org.kde.kio.kpasswdserver: User = "" , WindowId = 75497476
Jan 30 00:54:40 d2-lin org.kde.kpasswdserver[1323]: kf5.kiod: loadModule "kpasswdserver"
Jan 30 00:54:40 d2-lin org.kde.kpasswdserver[1323]: org.kde.kio.kpasswdserver: User = "" , WindowId = 0
Jan 30 00:54:41 d2-lin org.kde.kpasswdserver[1323]: kf5.kiod: loadModule "kpasswdserver"
Jan 30 00:54:41 d2-lin org.kde.kpasswdserver[1323]: org.kde.kio.kpasswdserver: User = "" , WindowId = 0
Jan 30 00:54:43 d2-lin org.kde.kpasswdserver[1323]: kf5.kiod: loadModule "kpasswdserver"
Jan 30 00:54:43 d2-lin org.kde.kpasswdserver[1323]: org.kde.kio.kpasswdserver: User = "" , WindowId = 0


I have tried sftp://scott@hud, but this makes no difference.

When there's no "hop", things work perfectly. For example:

sftp://192.168.0.21

or (from the above example):

sftp://homeserver
Comment 1 Wari Wahab 2017-08-24 06:24:40 UTC
I can confirm this.

<code>
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: file system free space of QUrl("sftp://dev2-152")
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: checking cache: info.username = "" , info.url = "sftp://dev2-152"
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: Creating the SSH session and setting options
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: Trying to connect to the SSH server
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: username= "" , host= "dev2-152" , port= 22
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp:
Aug 24 14:20:21 dealio kdeinit5[2438]: log_kio_sftp: connected ? false username: old= "" new= ""
</code>

I can `sftp dev2-152` fine on the command line.

dev2-152 definition on ~/.ssh/config almost the same as OP. Connecting using `sftp://192.168.2.152` works (that's a direct connection to the server instead of going through a hop)
Comment 2 Scott Deagan 2018-10-22 12:04:33 UTC
I have found a workaround for this: in Dolphin, use "fish://" instaead of "sftp://".

As an example, consider the following in your ~/.ssh/config:

Host ExternalHost             # Host A - external/Internet facing.
    Hostname 123.123.123.123  # Public IP address for Host A.
    User myusername           # Username for Host A.
    IdentityFile ~/.ssh/external_machine_private_key


Host InternalHost            # Host B - internal (target host).
    HostName 192.168.0.123   # IP address of target host on internal LAN.
    User yourusername        # User on Host B.
    IdentityFile ~/.ssh/your_private_key  # Private key for Host B.
    ProxyCommand ssh -q ExternalHost nc -w100000 %h %p 2> /dev/null

In Dolphin, pressing CTRL + L (to make the address bar editable), then enter:

fish://InternalHost

This works as expected - Dolphin will open the user's home directory on 192.168.0.123.
Comment 3 Philipp Maierhöfer 2018-12-08 15:43:03 UTC
This is a bug in libssh that has just been fixed. See https://bugs.libssh.org/T109.
Comment 4 Nate Graham 2018-12-08 15:44:36 UTC
Great news!