HostName not quite working as expected? - openssh

This is a discussion on HostName not quite working as expected? - openssh ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: HostName not quite working as expected?

  1. Re: HostName not quite working as expected?

    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):

    > Host Restricts the following declarations (up to the next Host key-
    > word) to be only for those hosts that match one of the patterns
    > given after the keyword. If more than one pattern is provided,
    > they should be separated by whitespace. A single `*' as a pat-
    > tern can be used to provide global defaults for all hosts. The
    > host is the hostname argument given on the command line (i.e. the
    > name is not converted to a canonicalized host name before match-
    > ing).


    -d

    _______________________________________________
    openssh-unix-dev mailing list
    openssh-unix-dev@mindrot.org
    https://lists.mindrot.org/mailman/li...enssh-unix-dev


  2. HostName not quite working as expected?

    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
    _______________________________________________
    openssh-unix-dev mailing list
    openssh-unix-dev@mindrot.org
    https://lists.mindrot.org/mailman/li...enssh-unix-dev


  3. Re: HostName not quite working as expected?

    Jay Levitt wrote:
    > as a workaround for "Host" entries not canonicalizing via DNS.


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


    //Peter
    _______________________________________________
    openssh-unix-dev mailing list
    openssh-unix-dev@mindrot.org
    https://lists.mindrot.org/mailman/li...enssh-unix-dev


  4. Re: HostName not quite working as expected?

    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"
    entries.

    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 myhost.example.com. 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...
    _______________________________________________
    openssh-unix-dev mailing list
    openssh-unix-dev@mindrot.org
    https://lists.mindrot.org/mailman/li...enssh-unix-dev


+ Reply to Thread