I have an ssh config file with something like this that I am not understanding.

Host my_alias
    HostName me@myserver.com
    HostName %h
    ProxyCommand ssh -W %h:%p me2.myserver.com

I thought %h stood for Hostname. What is the meaning of HostName %h?


You would typically use Hostname %h like

Host my-*
    Hostname %h.site.dom

which would expand any host starting with my- (e.g. my-test) to the FQDN (e.g. my-test.site.dom)

Hostname %h on it's own won't do anything.

As you also define HostName me@myserver.com first (and ssh_config says "For each parameter, the first obtained value will be used.") the entry will be ignored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.