Right - I know you've had a discussion about the argv[0] stuff already, but I've written this simple script to simulate the (now missing) support for Debian, and was asked to send it to you... --- ssh-argv0 --- #! /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 ssh "${0##*/}" "$@" ------ end ------ -- ssh-argv0.1 -- .Dd September 7, 2001 .Dt SSH-ARGV0 1 .Os Debian Project .Sh NAME .Nm ssh-argv0 .Nd replaces the old ssh command-name as hostname handling .Sh SYNOPSIS .Ar hostname | user at hostname .Op Fl l Ar login_name .Op Ar command .Pp .Ar hostname | user at hostname .Op Fl afgknqstvxACNPTX1246 .Op Fl c Ar cipher_spec .Op Fl e Ar escape_char .Op Fl i Ar identity_file .Op Fl l Ar login_name .Op Fl m Ar mac_spec .Op Fl o Ar option .Op Fl p Ar port .Oo Fl L Xo .Sm off .Ar port : .Ar host : .Ar hostport .Sm on .Xc .Oc .Oo Fl R Xo .Sm off .Ar port : .Ar host : .Ar hostport .Sm on .Xc .Oc .Op Ar command .Sh DESCRIPTION .Nm replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally .Sh OPTIONS See .Xr ssh 1 .Sh FILES See .Xr ssh 1 .Sh AUTHORS OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation. .Sh SEE ALSO .Xr ssh 1 ------ end ------ ----- patch ----- --- ssh.1.orig Fri Sep 7 20:03:05 2001 +++ ssh.1 Fri Sep 7 20:17:29 2001 @@ -1404,6 +1404,7 @@ .Xr scp 1 , .Xr sftp 1 , .Xr ssh-add 1 , +.Xr ssh-argv0 1 , .Xr ssh-agent 1 , .Xr ssh-keygen 1 , .Xr telnet 1 ,
I would rather see people submit C code to correct the issue than shell script hacks. Nothing personal, but lets solve this problem correctly and not half-ass. - Ben On Thu, 13 Sep 2001, Jonathan Amery wrote:> > Right - I know you've had a discussion about the argv[0] stuff > already, but I've written this simple script to simulate the (now > missing) support for Debian, and was asked to send it to you... > > --- ssh-argv0 --- > #! /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 > ssh "${0##*/}" "$@" > ------ end ------ > -- ssh-argv0.1 -- > .Dd September 7, 2001 > .Dt SSH-ARGV0 1 > .Os Debian Project > .Sh NAME > .Nm ssh-argv0 > .Nd replaces the old ssh command-name as hostname handling > .Sh SYNOPSIS > .Ar hostname | user at hostname > .Op Fl l Ar login_name > .Op Ar command > .Pp > .Ar hostname | user at hostname > .Op Fl afgknqstvxACNPTX1246 > .Op Fl c Ar cipher_spec > .Op Fl e Ar escape_char > .Op Fl i Ar identity_file > .Op Fl l Ar login_name > .Op Fl m Ar mac_spec > .Op Fl o Ar option > .Op Fl p Ar port > .Oo Fl L Xo > .Sm off > .Ar port : > .Ar host : > .Ar hostport > .Sm on > .Xc > .Oc > .Oo Fl R Xo > .Sm off > .Ar port : > .Ar host : > .Ar hostport > .Sm on > .Xc > .Oc > .Op Ar command > .Sh DESCRIPTION > .Nm > replaces the old ssh command-name as hostname handling. > If you link to this script with a hostname then executing the link is > equivalent to having executed ssh with that hostname as an argument. > All other arguments are passed to ssh and will be processed normally > .Sh OPTIONS > See > .Xr ssh 1 > .Sh FILES > See > .Xr ssh 1 > .Sh AUTHORS > OpenSSH is a derivative of the original and free > ssh 1.2.12 release by Tatu Ylonen. > Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, > Theo de Raadt and Dug Song > removed many bugs, re-added newer features and > created OpenSSH. > Markus Friedl contributed the support for SSH > protocol versions 1.5 and 2.0. > Jonathan Amery wrote this ssh-argv0 script and the associated > documentation. > .Sh SEE ALSO > .Xr ssh 1 > ------ end ------ > ----- patch ----- > --- ssh.1.orig Fri Sep 7 20:03:05 2001 > +++ ssh.1 Fri Sep 7 20:17:29 2001 > @@ -1404,6 +1404,7 @@ > .Xr scp 1 , > .Xr sftp 1 , > .Xr ssh-add 1 , > +.Xr ssh-argv0 1 , > .Xr ssh-agent 1 , > .Xr ssh-keygen 1 , > .Xr telnet 1 , > >
In article <Pine.BSO.4.33.0109131415190.22017-100000 at etoh.eviladmin.org> you write:> >I would rather see people submit C code to correct the issue than >shell script hacks. Nothing personal, but lets solve this problem >correctly and not half-ass. >In what way is this (POSIX shell) script a 'hack'? It's already been decided that it's impossible to do it right in the main ssh code (what if you rename ssh was IIRC the main argument), and C is not the right language to do the job (particularly given it's dodgy string handling). Also OpenSSH already distribute one shell script (in contrib) - ssh-copy-id (which *is* dodgy and hacky, but I'm working on it). And I might note that one comment in the original discussion was that a shell script was precisely the right way to do it. If you don't want 'hacky' shell-scripts then feel free to revert to the old way of doing it, or write an equivilantly portable and bug-free C-programme. Jonathan.
Jonathan Amery <jdamery at pick.ucam.org> writes:> #! /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 > ssh "${0##*/}" "$@"What's wrong using with shell aliases to achieve the same effect? In fact I think shell aliases are actually better. For example, using bash alias syntax: alias pick="ssh jdamery at pick.ucam.org" would work even when ucam.org wasn't in the DNS search list or when your local username wasn't jdamery, situations in which just linking ~/bin/pick to your proposed ssh-argv0 would fail. (You could link ~/bin/jdamery at pick.ucam.org to it instead, but that would result in more typing.) -- http://www.greenend.org.uk/rjk/
In article <84vgim2bv6.fsf at rjk.greenend.org.uk> you write:>Jonathan Amery <jdamery at pick.ucam.org> writes: > >> #! /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 >> ssh "${0##*/}" "$@" >What's wrong using with shell aliases to achieve the same effect?(a) This replaces a feature that was removed from openssh in 2.3.something (or there abouts). (b) The only way I've seen the feature used on a large scale is to have a symlink farm in /usr/local/<something> which then allows all users of the machines to use this feature, regardless of which shell they use (and in local scripts and the like).>In fact I think shell aliases are actually better. For example, using >bash alias syntax: > > alias pick="ssh jdamery at pick.ucam.org" > >would work even when ucam.org wasn't in the DNS search list or when >your local username wasn't jdamery, situations in which just linking >~/bin/pick to your proposed ssh-argv0 would fail.That's what your .ssh/config is for, for example (from my .ssh/config at work): Host chiark HostName login.chiark.greenend.org.uk Compression yes CompressionLevel 9 User jdamery FallBackToRsh no And a symlink from ~/bin/chiark -> /usr/bin/ssh However, I do suspect that most users of the feature are sysadmins of machines within the same administrative control and hence this will not be needed. Jonathan.