After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688308 - sftp server connection in the location bar ignores the ssh config file
sftp server connection in the location bar ignores the ssh config file
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: sftp backend
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 764827 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-14 10:57 UTC by Antonio
Modified: 2016-04-15 18:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sftp: Show original hostname in the password prompt (3.39 KB, patch)
2016-04-12 08:40 UTC, Ondrej Holy
committed Details | Review

Description Antonio 2012-11-14 10:57:43 UTC
I defined some shortcuts in ~/.ssh/config like

Host ShortcutName
HostName servername
User username

These shortcuts work when I ssh to a server in the terminal (or mount the same server with sshfs) but are ignored by nautilus. When I use in the location bar a string like

sftp://ShortcutName

I'm asked for the username and password for the server "ShortcutName" and if I type them in the connection fails (obviously).

Looks like this used to work in the past and would come in handy. I'm on Ubuntu 12.10.
Comment 1 Cosimo Cecchi 2012-11-20 15:24:39 UTC
-> gvfs

This is  probably a gvfs bug.
Comment 2 Fabio Fantoni 2012-11-27 14:43:00 UTC
I have the same problem on Ubuntu 12.04.

Seem the same bug fixed in past and now reappared reported here:
https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/264803
https://bugzilla.gnome.org/show_bug.cgi?id=550929

Someone can solve please?
Comment 3 Fabio Fantoni 2013-02-06 14:43:49 UTC
Anyone on this?
Comment 4 Filipe 2013-05-03 10:34:15 UTC
I've have the same problem with Fedora release 17 and I have this packages 
gvfs-1.12.3-1.fc17.i686
Comment 5 Bastien Nocera 2016-04-09 20:45:54 UTC
*** Bug 764827 has been marked as a duplicate of this bug. ***
Comment 6 Ondrej Holy 2016-04-12 07:58:54 UTC
I tried this...

(In reply to Antonio from comment #0)
> I defined some shortcuts in ~/.ssh/config like
> 
> Host ShortcutName
> HostName servername
> User username
> 
> These shortcuts work when I ssh to a server in the terminal (or mount the
> same server with sshfs) but are ignored by nautilus. When I use in the
> location bar a string like

The shortcuts are not ignored by GVfs (Nautilus). "ShortcutName" is used in GIO URI, but GVfs tries to mount to "servername" in the background... we should probably show the original servername at least in the password prompt.
 
> I'm asked for the username and password for the server "ShortcutName" and if
> I type them in the connection fails (obviously).

It works correctly for me. Only problem is that you have to specify username even if it is already specified in the config file. So it is probably another bug if it fails for you. Did you really use the same username as you have in the config file?
 
The problem is that ssh uses login name by default if username is not specified and the backend doesn't know that the username is already specified in the config file. So GVfs has to ask for username in such case...

You can do following if you don't want to specify the username everytime:
- You can bookmark the location in the Nautilus (including the username). 
- You can set up key-based authentication and you don't have to specify neither the password...
Comment 7 Ondrej Holy 2016-04-12 08:40:48 UTC
Created attachment 325773 [details] [review]
sftp: Show original hostname in the password prompt

Server shortcuts may be configured in ~/.ssh/config. Shortcut name may be used in the URI consequently, however underlying SSH daemon connects to the original hostname, which might be confusing and potential security issue. Show the original hostname in the password prompt from the mentioned reasons.
Comment 8 cosama 2016-04-12 16:07:03 UTC
It works for me too. I never tried to properly put the user name in the field that pops up.

I agree putting the hostname in the password prompt would help a lot to understand what exactly is going on here. Also I could not find any information about this behavior, which now should be easier to figure out, as it is mentioned here.

I mainly needed the ./.ssh/config to define some login options, which I can do now. I agree the username can be stored in a bookmark, so having to repeat it is not such a big issue.

If there is no simple way to cache the user name directly from the /.ssh/config, I would assume we can consider this bug as solved.

Sorry for opening a new bug, I was not sure what the best behavior is for a bug that is open since quite some time.
Comment 9 Ondrej Holy 2016-04-13 07:08:55 UTC
(In reply to cosama from comment #8)
> It works for me too. I never tried to properly put the user name in the
> field that pops up.

Ok, thanks for feedback.

> I agree putting the hostname in the password prompt would help a lot to
> understand what exactly is going on here. Also I could not find any
> information about this behavior, which now should be easier to figure out,
> as it is mentioned here.
> 
> I mainly needed the ./.ssh/config to define some login options, which I can
> do now. I agree the username can be stored in a bookmark, so having to
> repeat it is not such a big issue.

I also forget that you can use keyring to store the credentials if you choose "Remember forever" in Nautilus.

> If there is no simple way to cache the user name directly from the
> /.ssh/config, I would assume we can consider this bug as solved.

I will close the bug later - after I will push the patch, which I do not plan to push to stable branch now, so I will wait till GVfs will be branched...

> Sorry for opening a new bug, I was not sure what the best behavior is for a
> bug that is open since quite some time.

Opening a new bug is not a definitely good idea, it is better to add a comment  with some additional info in the already existing bug...
Comment 10 Ondrej Holy 2016-04-15 15:14:06 UTC
Comment on attachment 325773 [details] [review]
sftp: Show original hostname in the password prompt

commit 00ed5c6320d9cab35e5a4c12f3e35ec10dc3fb62