How to use ssh tags on ssh_config

Alvaro Torijano asked:

Hi i’m wondering how to use a previously defined tag in my ssh_config file which looks like this

Host myhost
        Hostname myhost.ddns.net

Match user jhonfoo host myhost
        IdentityFile ~/.ssh/myhost

My answer:


The man page states, in relevant part:

The criteria for the host keyword are matched against the target hostname, after any substitution by the Hostname or CanonicalizeHostname options. The originalhost keyword matches against the hostname as it was specified on the command-line.

Therefore you should Match user jhonfoo originalhost myhost instead.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.