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

4.8 Selecting a default host

Finally, it is even possible to omit the host name part of a TRAMP file name. This case, the value of the variable tramp-default-host is used. Per default, it is initialized with the host name your local Emacs is running.

If you, for example, use TRAMP mainly to contact the host ‘target’ as user ‘john’, you can specify:

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

Then the simple file name ‘/ssh::’ will connect you to John’s home directory on target. Note, however, that the most simplification ‘/::’ won’t work, because ‘/:’ is the prefix for quoted file names.

Like with methods and users, you can also specify different default hosts for certain method/user combinations via the variable tramp-default-host-alist. Usually, this isn’t necessary, because tramp-default-host should be sufficient. For some methods, like adb, that default value must be overwritten, which is already the initial value of tramp-default-host-alist.

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