Next: , Previous: , Up: Configuration   [Contents][Index]

4.8 Selecting a default host

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

(setq tramp-default-user "john"
      tramp-default-host "target")

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

Note/::’ won’t work, because ‘/:’ is the prefix for quoted file names.

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.

See the documentation for the variable tramp-default-host-alist for more details.