I have a config file to setup defaults for tramp. For the purposes of this example foo
and bar
are hosts defined in /etc/hosts
.
(require 'tramp)
(setq tramp-default-method "ssh")
(add-to-list 'tramp-default-user-alist
'("ssh" "foo" "user1"))
(add-to-list 'tramp-default-user-alist
'("ssh" nil "user2") t)
From this link I expect to then be able to use the following shorthand:
eg1 - load filename
from user1@foo
C-x C-f /foo:filename
rather than C-x C-f /ssh:user1@foo:filename
eg2 - load filename
from user2@any_server
, here we've picked bar
C-x C-f /bar:filename
rather than C-x C-f /ssh:user2@bar:filename
Both of the left-hand shorthands fail on typing C-x C-f /foo:
- options given suggest that Emacs has not recognized foo
as a server (perhaps it's recognizing it as a connection method?).
Both of the right-hand long-winded versions work, as does the following:
C-x C-f /ssh:foo:filename
i.e. Tramp is correctly finding the default user1
, but seems not to find the default connection type of ssh
.
I've tried running Emacs as emacs --no-init-file
to make sure it's not something in my init file. But doing that, and loading only the Tramp settings manually, the issue is identical.
As a final attempt I tried adding to tramp-default-method-alist
instead.
(add-to-list 'tramp-default-method-alist
'(nil nil "ssh"))
And also this:
(customize-set-variable 'tramp-default-method "ssh")
These don't work either - although in every case I do see the variable has been set with M-x Customize
.
I'm using 26.1 with built-in tramp on Ubuntu 18.04:
tramp 2.3.3.26.1 built-in Transparent Remote Access, Multiple Protocol
I'm probably missing something obvious, given it's such a simple thing to setup! Can anyone point me in the right direction - it's driving me nuts!