Created attachment 1918 [details] Patch to add RemoteCommand and PseudoTTY to openssh-5.1p1-6ubuntu2 Hi, I'd like to have a RemoteCommand and PseudoTTY config option for ssh_config. I have multiple use cases. One of them is e. g. connecting to SourceForge. Of course I can do all that I can do with RemoteCommand and PseudoTTY also with an alias or shell script, but I prefer to keep my configuration in one place and that is the ssh config files. So to connect to the SourceForge shell service you have to call "create" first. Either you do this with "-t" and are logged into the newly created shell immediately, or you do it without "-t" and can then connect to the newly created shell with a new connection. So my workaround for this case was to use the following ProxyCommand which is not nice of course, but worked. For other use-cases I didn't find such a work-around. ProxyCommand sh -c "ssh -F /dev/null -C vampire0,jedit@shell.sf.net create; nc %h %p" With RemoteCommand and PseudoTTY this can be easily and cleanly achieved by the following: PseudoTTY yes RemoteCommand create As I'm currently still using Ubuntu Karmic which has OpenSSH 5.1p1 packaged I've put my ideas into the sources of that package. I've created a patch-file of the changes I did and attached this here. It is working fine for me up to now. I hope it can be used to adapt this to the latest code also and to make clear how I mean and excpect this feature. :-)
OpenSSH 5.9 will have a RequestTTY option, but I don't think we need an option to specify the command
May I ask why not? This possibility proved to be veeery useful to me. I'm doing things like the following with it: config: Host wbl RemoteCommand wakeonlan -f wol/bjkau-linux.wol command to wake up my box remotely: ssh wbl config: Host v2bl User root LocalForward 5900 localhost:5900 RemoteCommand x11vnc -localhost -timeout 120 -display :0 -auth /var/lib/gdm/:0.Xauth command to start a secure remote x11vnc session: ssh v2bl vinagre localhost (or invoked via GUI) config which would be possible without RemoteCommand but veeeeery ugly like shown in the initial comment: Host sf* shell.sf.net shell.sourceforge.net HostName shell.sourceforge.net RequestTTY yes RemoteCommand create command to connect to SF Shell service: ssh sfj I would really miss this feature if it doesn't get added and always building an own version with my patch is cumbersome. :-( I'd really appreciate if this also gets added like suggested.
(In reply to comment #2) > May I ask why not? My personal opinion would be that this is a job for a script. And note that this is even shorter to type: > config: > > Host v2bl > User root > LocalForward 5900 localhost:5900 > RemoteCommand x11vnc -localhost -timeout 120 -display :0 -auth > /var/lib/gdm/:0.Xauth > > command to start a secure remote x11vnc session: > > ssh v2bl v2bl.sh: #!/bin/sh exec ssh v2bl -t x11vnc -localhost -timeout 120 -display :0 -auth > /var/lib/gdm/:0.Xauth command: v2bl.sh
Of course as script or alias it is shorter to type. But I like to have this configuration there. And those also were only examples, there are for sure other use-cases. And hey, if someone doesn't want to use the feature he doesn't have to and can still use scripts or aliases. :-) While neither scripts nor aliases are portable. The ssh config file I can also copy over to a Windows machine running openssh and can immediately use it. Aliases are not possible on Windoze and a script would have to be rewritten as BAT script. Besides that especially the SourceForge case does belong in that config file logically as that "create" command is necessary to establish an SSH connection to the SourceForge shell service. That is why it was my example in the initial description.
One possible use case for RemoteCommand would be to set different prompts on certain machines (e.g. if we SSH to the production server, change the prompt to red). This could be done via sshrc, but that might be inconvenient or controversial if the remote account is used by many different people.
if you're using openssh on windows you've likely got enough of cygwin to run shell scripts as well. anyway: we're not adding RemoteCommand because it is not needed. there's lots of other ways of achieving the same goal: a local script, remote ForceCommand, remote sshrc, remote shell startup file.
This is not FIXED, at most it is WONTFIX. But I cannot agree with "it is not needed". remote ForceCommand, remote sshrc and remote shell startup file can only support one command per user per host (the first even one command for all users) and also the SourceForge usecase is NOT POSSIBLE with it. local script is possible of course, but you can replace most of the other ssh Options by a local script also with using command-line parameters. And the SourceForge case is also there NOT POSSIBLE when trying to use rsync or scp.
We added RequestTTY, that's why it was marked as fixed. We don't agree with your rationale for the RemoteCommand changes and have decided not to add it.
Close all resolved bugs after 7.3p1 release