GNOME Bugzilla – Bug 604762
Default port numbers are removed from bookmark destinations
Last modified: 2018-09-21 16:59:53 UTC
When e.g. creating a bookmark with the destination sftp://user@server:22/folder Nautilus will remove the port number. It only does it when the port number is considered default. However, it still does so when a different port number has been set as default, e.g. by changing the value in /etc/ssh/ssh_config concerning the default port number. The consequence of this behaviour is that bookmarks to locations using default port numbers don't work on systems using custom port numbers. This bug was originally reported by sjcire on Launchpad in Ubuntu at <https://launchpad.net/bugs/343000>.
I can confirm this bug, and it has been confirmed in the launchpad bug mentioned above. I hope this gets fixed pretty soon, but for now, this status can be changed to confirmed here.
This is still reproducible, despite the redesign of connect to server UI. The default port number is dropped from the path shown in the Location entry and saved in the "Recent Servers" list. This looks like a gvfs bug or feature. In gvfs/client/gdaemonvfs.c there is a condition that, as far a I understand, check if the provided port is different from default_port. Maybe that's what causes this? Tentatively reassigning to gvfs.
Yes, this is caused by GVfs. GVfs tries to simplify the uris as much as possible in order to avoid duplicated mounts e.g. with/without default port. It does not expect that default port can be changed... As far as I can tell, "ssh" doesn't provide any API to obtain the default port setting and sshd_config is not usually readable by a regular user, so GVfs can't react on it. So, this feature has to be probably disabled for sftp backend probably, or the default port has to be always used internally at least... You can change the DefaultPort entry in the following file to match your configuration as a workaround: /usr/share/gvfs/mounts/sftp.mount
Created attachment 359214 [details] [review] sftp: Always use port 22 if not specified Currently, the default port - specified in mount file - is removed from uri on client side, but it is not used by backend explicitely. It is not a problem until the default port is changed in sshd_config and somebody wants to connect to the server using the default port from mount file. Let's use the port 22 explicitely, similarly as other backends do (i.e. ftp, afc, afp).
It would be nice to obtain the default port from the mount file somehow in the backend, or handle this by mount tracker, but let's use this solution for beginning (it is used by other backends anyway)...
Can you please test the attached patch?
I can't test, sorry. My comment 2 was misleading. When I said this was reproducible, I meant gvfs droping port 22 from URI. I'm not able to actually test this with a non-22 default port.
Review of attachment 359214 [details] [review]: This fix has one unwanted effect. If you don't specify the port and non-standard port is used, than e.g. sftp://localhost/ will not work, but works correctly currently... I am thinking about removal of that code from gdaemonvfs, so sftp://localhost/ would mean to use default port defined in sshd_config and not 22... I've just realized that this bug applies also on ftp backend...
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/129.