Hacker News new | ask | show | jobs
by salted-fry 2898 days ago
Interestingly:

  $ telnet localhost ssh
  Trying ::1...
  Connected to localhost.
  Escape character is '^]'.
  SSH-2.0-OpenSSH_7.7
Obviously, it's just getting translated from ssh to 22 under-the-hood. I'm not sure who's doing the translation, though.
2 comments

This is often mapped by applications which read /etc/services for the information.
That should be defined in /etc/services.

~  grep ssh /etc/services ssh 22/tcp # SSH Remote Login Protocol

And /etc/nsswitch.conf is configured to look at 'files' to see which ports map to which services.