4.8 Selecting a default host

User Option: tramp-default-host

When host name is omitted, TRAMP substitutes the value from the tramp-default-host user option. It is initially populated with the local host name where Emacs is running. The default method, default user and default host can be overridden as follows:

(custom-set-variables
 '(tramp-default-method "ssh")
 '(tramp-default-user "john")
 '(tramp-default-host "target"))

With all defaults set, ‘/-::’ will connect TRAMP to John’s home directory on target via ssh.

User Option: tramp-default-host-alist

Instead of a single default host, tramp-default-host-alist allows multiple default host values based on access method or user name combinations. The alist can hold multiple values. While tramp-default-host is sufficient in most cases, some methods, like adb, require defaults overwritten.