GNOME Bugzilla – Bug 752403
Fails to connect ("SSH program unexpectedly exited")
Last modified: 2015-08-10 06:28:33 UTC
$ gvfs-mount sftp://root@diskstation.local/volume1/music Error mounting location: SSH program unexpectedly exited Jul 15 08:35:29 nuvo org.gtk.vfs.Daemon[1984]: ### SFTP: spawn_ssh: /usr/bin/ssh -oForwardX11 no -oForwardAgent no -oPermitLocalCommand no -oClearAllForwardings yes -oProtocol 2 -oNoHostAuthenticationForLocalhost yes -l root -s diskstation.local sftp Jul 15 08:35:29 nuvo org.gtk.vfs.Daemon[1984]: ### SFTP: handle_login #1 - user: root, host: diskstation.local, port: -1 Jul 15 08:35:30 nuvo org.gtk.vfs.Daemon[1984]: ### SFTP: handle_login #1 - password_save: 0 Jul 15 08:35:30 nuvo org.gtk.vfs.Daemon[1984]: ### SFTP: handle_login #1 - ret_val: 1 Jul 15 08:35:30 nuvo org.gtk.vfs.Daemon[1984]: ** (gvfsd:2038): WARNING **: dbus_mount_reply: Error from org.gtk.vfs.Mountable.mount(): SSH program unexpectedly exited If the line in the log is the full command, then: $ /usr/bin/ssh -oForwardX11 no -oForwardAgent no -oPermitLocalCommand no -oClearAllForwardings yes -oProtocol 2 -oNoHostAuthenticationForLocalhost yes -l root -s diskstation.local sftp ; echo $? command-line line 0: missing argument. 255 $ rpm -qf /usr/bin/ssh openssh-clients-6.8p1-8.fc22.x86_64
You need to quote the options: $ /usr/bin/ssh '-oForwardX11 no' '-oForwardAgent no' '-oPermitLocalCommand no' '-oClearAllForwardings yes' '-oProtocol 2' '-oNoHostAuthenticationForLocalhost yes' -l root -s diskstation.local sftp Of course, since it's a binary protocol, you can't really do anything useful... My guess is that the NAS is running dropbear or something which either doesn't support sftp or it is incompatible. Do you know what sftp server it is running? Usually you can just scrape the server version by running "nc diskstation.local 22". Also can you try running the following just to see if it connects properly with the normal command-line sftp client: $ sftp root@diskstation.local Connected to diskstation.local. sftp>
(In reply to Ross Lagerwall from comment #1) > You need to quote the options: > > $ /usr/bin/ssh '-oForwardX11 no' '-oForwardAgent no' '-oPermitLocalCommand > no' '-oClearAllForwardings yes' '-oProtocol 2' > '-oNoHostAuthenticationForLocalhost yes' -l root -s diskstation.local sftp Sure. > Of course, since it's a binary protocol, you can't really do anything > useful... > > > My guess is that the NAS is running dropbear or something which either > doesn't support sftp or it is incompatible. Do you know what sftp server it > is running? Usually you can just scrape the server version by running "nc > diskstation.local 22". It says: SSH-2.0-OpenSSH_6.6p2-hpn14v4 > Also can you try running the following just to see if it connects properly > with the normal command-line sftp client: > $ sftp root@diskstation.local > Connected to diskstation.local. > sftp> $ sftp root@diskstation.local subsystem request failed on channel 0 Couldn't read packet: Connection reset by peer
(In reply to Bastien Nocera from comment #2) > > Also can you try running the following just to see if it connects properly > > with the normal command-line sftp client: > > $ sftp root@diskstation.local > > Connected to diskstation.local. > > sftp> > > $ sftp root@diskstation.local > subsystem request failed on channel 0 > Couldn't read packet: Connection reset by peer It looks like sftp does not work with this device. Perhaps you need to do something like http://forum.synology.com/wiki/index.php/How_to_setup_an_sftp-server Not a gvfs bug though...
(In reply to Ross Lagerwall from comment #3) > (In reply to Bastien Nocera from comment #2) > > > Also can you try running the following just to see if it connects properly > > > with the normal command-line sftp client: > > > $ sftp root@diskstation.local > > > Connected to diskstation.local. > > > sftp> > > > > $ sftp root@diskstation.local > > subsystem request failed on channel 0 > > Couldn't read packet: Connection reset by peer > > It looks like sftp does not work with this device. Perhaps you need to do > something like > http://forum.synology.com/wiki/index.php/How_to_setup_an_sftp-server > > Not a gvfs bug though... The dreadful error message is gvfs' problem though.
Created attachment 307667 [details] [review] sftp: Improve error messages on connection setup Log all the messages from SSH's stderr. If the remote server does not have sftp setup correctly, it fails with "subsystem request failed". Report this as "Connection refused". If the error is unknown, report it as "Connection failed" rather than "SSH program unexpectedly exited" which shouldn't be exposed to users.
Review of attachment 307667 [details] [review]: Looks good with the nitpick... ::: daemon/gvfsbackendsftp.c @@ +344,3 @@ } + + DEBUG("stderr: %s\n", line); Missing space before opening parenthesis
Pushed to master as 0da49dd. Thanks for the review.