ssh-argv0 - useful if you're on Debian

I stumbled upon an interesting way to connect to remote hosts with ssh where creating symlinks to ssh-argv0 allows connecting simply by typing the hostname, for example:

$ frodo

would work if frodo was a symlink previously created like this:

$ ln -s /usr/bin/ssh-argv0 frodo

Nice. Except it isn't. Not unless you're using the Debian OpenSSH Client pacakge (e.g you're using Debian or one of its derivatives such as Ubuntu or Mint). If not, then you're unlikely to find ssh-argv0 on your system. Nonetheless, I found myself on an interesting investigative digression. Non Debian derivatives like Arch Linux or MacOS don't include this extension but, should you want it, it's a simple shell script.

The capability originated in times past when early versions of SSH supported the above behaviour by symlinking to the main ssh client executable. But this feature was removed around version 2.5 (according to the following Debian patch). Debian provids ssh-argv0 to re-implement what was removed, reintroducted as a patch in September of 2001:

The gist of the patch provides a shell script, to be saved as /usr/bin/ssh-argv0, like this:

#! /bin/sh -e
if [ "${0##*/}" = "ssh-argv0" ]
then
  echo 'ssh-argv0: This script should not be run like this, see ssh-argv0(1) for details' 1>&2
  exit 1
fi
exec ssh "${0##*/}" "$@"

This independent article includes another implementation of the same script.

Note that the current upstream the OpenSSH Portable release, mirrored on GitHub, does not include this functionality.