Variable: tramp-default-user-alist
tramp-default-user-alist is a customizable variable defined in
tramp.el.gz.
Value
(("\\`\\(?:r\\(?:cp\\|emcp\\|sh\\)\\|telnet\\)\\'" nil "root")
("\\`\\(?:doas\\|su\\(?:do\\)?\\)\\'" nil "root")
("\\`smb\\'" nil nil) ("\\`sudoedit\\'" nil "root"))
Documentation
Default user to use for specific method/host pairs.
This is an alist of items (METHOD HOST USER). The first matching item
specifies the user to use for a file name which does not specify a
user. METHOD and HOST are regular expressions or nil, which is
interpreted as a regular expression which always matches. If no entry
matches, the variable tramp-default-user takes effect.
If the file name does not specify the method, lookup is done using the empty string for the method name.
Probably introduced at or before Emacs version 23.1.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;;;###tramp-autoload
(defcustom tramp-default-user-alist nil
;; FIXME: This is not an "alist", because its elements are not of
;; the form (KEY . VAL) but (KEY1 KEY2 VAL).
"Default user to use for specific method/host pairs.
This is an alist of items (METHOD HOST USER). The first matching item
specifies the user to use for a file name which does not specify a
user. METHOD and HOST are regular expressions or nil, which is
interpreted as a regular expression which always matches. If no entry
matches, the variable `tramp-default-user' takes effect.
If the file name does not specify the method, lookup is done using the
empty string for the method name."
:type '(repeat (list (choice :tag "Method regexp" regexp sexp)
(choice :tag " Host regexp" regexp sexp)
(choice :tag " User name" string (const nil)))))