HostName not quite working as expected?

Jay Levitt lists-ssh at jay.fm
Fri Aug 29 06:34:11 EST 2008


Setting up a few hosts in a small domain, I thought I'd save keystrokes 
by defining ssh_config aliases for their
non-canonicalized names.  For example:

Host myhost
  HostName myhost.example.com

Host *.example.com
  Port 23
  ...

I would have expected that "ssh myhost" would then start a session on 
port 23 (instead of 22).  And I've seen blog/list posts that suggest the 
same (which, of course, I can't find now), as a workaround for "Host" 
entries not canonicalizing via DNS.

But that's not what happens.  "ssh myhost" correctly connects to 
myhost.example.com, but doesn't pick up any of the *.example.com host 
configuration.  Likewise adding:

Host myhost.example.com
  Port 23

it still connects on port 22.

Is this the intended behavior?  It seems like a bug to me, but it's 
still present in the 20080829 5.1 snapshot, and nobody's ever mentioned 
it before.  Maybe it's just something that could be documented better?

Jay Levitt


More information about the openssh-unix-dev mailing list