[emacs-berlin] Tramp mode with custom location for SSH config

Michael Albinus michael.albinus at gmx.de
Sat Mar 11 15:33:59 UTC 2023


jman <emacs-berlin at city17.xyz> writes:

> Hello,

Hi,

> I've instructed Tramp mode to look for SSH config in my custom
> dir (documentation[0]):
>
> (tramp-set-completion-function "ssh"
>  '((tramp-parse-sconfig "/etc/ssh_config")
>    (tramp-parse-sconfig "~/.config/ssh/config.d/config.whatevs")))
>
> That SSH config is a symlink.
>
> I get "could not resolve hostname ..." when trying to open
> "/ssh:hostname:".
>
> Worth mentioning that when I type "/ssh:" the prompt autocompletes the
> hostnames defined in that ssh config - so it seems that it is correctly
> loaded?
>
> What am I missing? :)

tramp-set-completion-function is used for host name completion only. It
doesn't change anything how Tramp calls ssh.

If you want your "~/.config/ssh/config.d/config.whatevs" file to be used
for the ssh connection, you might create a small file "~/.ssh/config"
with the contents

--8<---------------cut here---------------start------------->8---
Include ~/.config/ssh/config.d/config.whatevs
--8<---------------cut here---------------end--------------->8---

See (info "(tramp) Ssh setup")

Alternatively, you could add an own method to `tramp-methods' which adds
the "-F ~/.config/ssh/config.d/config.whatevs" option to the ssh call.

> thanks

Best regards, Michael.


More information about the emacs-berlin mailing list