Hello Michael, > Of course, it is possible to add a new method to tramp-methods. However, > there are disadvantages. For example, your new method won't benefit from > new/changed parameters of methods in tramp-methods, unless you care and > check regularly. For the sudo method, there is on my todo list to > empower it for direct async connections. This requires changes in > tramp-methods. > > Furthermore, tramp-methods isn't the only change for method > configuration. For the sudo method, we configure also > tramp-default-user-alist (default user "root"), > tramp-completion-function-alist (user/host name completion), "~/" in > expand-file-name, tramp-default-proxies-alist (multi-hop > configuration). I don't know whether you need this for your own method, > but you see, it is rather complex.
Thanks for clarifying. It is indeed complex – a custom method is
definitely the wrong approach for my use case then.
> Instead, the Tramp manual recommends to adapt a parameter for a given
> method of tramp-methods, specific to a remote target (a regexp). See the
> discussion in (info "(tramp) Predefined connection information") . In your
> case, I recommend you to apply
>
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'tramp-connection-properties
> (list (regexp-quote "/sudo:user@host:")
> "login-args"
> '(("SUDO_PROMPT=P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")
> ("sudo") ("-u" "%u") ("-i") ("%l"))))
> --8<---------------cut here---------------end--------------->8---
Cool, this works now. I've tried something similar before, but couldn't
get it to work. Turns out, the combination of this setting, adding
'tramp-own-remote-path to 'tramp-remote-path and a call to
tramp-cleanup-all-connections did the trick.
cheers, Til
signature.asc
Description: PGP signature
