tramp: Default User

 
 4.7 Selecting a default user
 ============================
 
 TRAMP file name can omit the user name part since TRAMP substitutes the
 currently logged-in user name.  However this substitution can be
 overridden with ‘tramp-default-user’.  For example:
 
      (setq tramp-default-user "root")
 
    Instead of a single default user, ‘tramp-default-user-alist’ allows
 multiple default user values based on access method or host name
 combinations.  The alist can hold multiple values.  For example, to use
 the ‘john’ as the default user for the domain ‘somewhere.else’ only:
 
      (add-to-list 'tramp-default-user-alist
                   '("ssh" ".*\\.somewhere\\.else\\'" "john"))
 
 See the documentation for the variable ‘tramp-default-user-alist’ for
 more details.
 
    A Caution: TRAMP will override any default user specified in the
 configuration files outside Emacs, such as ‘~/.ssh/config’.  To stop
 TRAMP from applying the default value, set the corresponding alist entry
 to nil:
 
      (add-to-list 'tramp-default-user-alist
                   '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
 
    The last entry in ‘tramp-default-user-alist’ should be reserved for
 catch-all or most often used login.
 
      (add-to-list 'tramp-default-user-alist
                   '(nil nil "jonas") t)