HostName not quite working as expected?

Jay Levitt lists-ssh at
Tue Sep 2 23:46:04 EST 2008

Damien Miller wrote:
> On Thu, 28 Aug 2008, Jay Levitt wrote:
>> 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.
> ...
>> 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?
> The behaviour is intended and documented. From ssh_config(5):

Yep, and I had read that part, but I had wrongly interpreted the HostName 
documentation to mean that specifying HostName, which creates "nicknames or 
abbreviations for hosts", would create nicknames or abbreviations for "Host" 

I think it'd be clearer to add something like "This option modifies only the 
hostname that ssh actually connects to; ssh still uses the original hostname 
argument to match Host patterns." And, perhaps, under Host:

          hostname argument given on the command line (i.e. the name is not
-        converted to a canonicalized host name before matching).
+        converted to a canonicalized host name before matching, and
          HostName aliases are not resolved).

But if you think it's clear, cool.

Peter Stuge wrote:

> By setting up DNS you could save keystrokes in all other apps too.

Oh, I've set up DNS.  But, at the moment, I have to provide all my 
host-specific parameters twice; once for Host myhost, and once for
Host  Otherwise, if I'm inconsistent in using 
tab-completion, I'll get inconsistent results.

I'm sure I could write a script to generate ssh_config from DNS, or 
something, if it bugged me enough...

More information about the openssh-unix-dev mailing list