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 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!


With Tramp 2.3 / Emacs 26.1, Tramp's syntax has changed. It requires now the method name mandatory. If you want the shorter version of Tramp file names (without the method), you must change the syntax via the command tramp-change-syntax syntax. See the Tramp manual, section Alternative file name syntax.

  • Thanks, for those yearning the old-ways you can add this to your start-up or change it directly in session (customize-set-variable 'tramp-syntax 'simplified) – Phil May 16 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.