[PATCH] Allow matching HostName against Host entries

Alan Barrett apb at cequrux.com
Thu Apr 11 15:06:06 EST 2013

I would find the proposed MatchHostName feature very useful.  It 
would allow me to remove a significant amount of duplication from 
my ssh config files.

On Tue, 09 Apr 2013, Ben Lindstrom wrote:
>My major complaint is this one option changes how the ssh_config is
>parsed.  It just takes one admin to decided he likes it to break everyone's

Sure.  The admin should not put "MatchHostname yes" in the system ssh
config file; it's something that users should be able to choose to put
in their own config files.

>host foo
>  user  specialaccount
>  hostname foo.bar.com
>host *.bar.com
>   user normaluser
>Which is horrible as it *DOES* break it if you enable that switch.

You could always override with "MatchHostName no", like this:

     MatchHostName yes # global setting

     host foo
       user  specialaccount
       hostname foo.bar.com
       MatchHostName no # override for "host foo"

     host *.bar.com
       user normaluser
       SomeOtherSetting "used for 'foo.bar.com', but not used for 'foo'"

--apb (Alan Barrett)

More information about the openssh-unix-dev mailing list