3

By transparently I mean forwarding of:

  • stdin, stdout and stderr
  • standard signals (SIGHUP or SIGINT would be great for a start)

As an example, consider these invocations of a (pointless) local and remote command:

$ `cat - > /dev/null; sleep 10` < /local/file
$ ssh user@host "cat - > /dev/null; sleep 10" < /local/file

I can interrupt the first one with ^C just fine. But if I try this during the second one it only affects ssh, leaving the command running on the remote server if cat has already finished.

I know about launching sshwith -t, but this way I can't send data via stdin. Is this possible with ssh alone at all?

ctrl-alt-delor
  • 149
  • 1
  • 13
jnsg
  • 31
  • 1

1 Answers1

0

Signals are the domain of the local kernel; they are not ever carried across a network link.

While you can run commands in a remote ssh session from a local computer, that does not magically make the system-level events on the remote computer available locally.

You would have to wrap the entire thing in a script that traps all (possible) signals and communicates these back across the ssh connection, but even then they wouldn't magically become signals again.

Perhaps something involving nc would be more appropriate for shuffling std{in|out|err} across; that, too, is not part of ssh's toolset.

adaptr
  • 16,479
  • 21
  • 33
  • I have noticed that the ssh protocol supports sending of signals, and exit values. But the openssh only seems to support exit values. I expected to be able to send a signal to ssh for it to Marshall it across to the sshd that would then in turn signal the remote process. – ctrl-alt-delor Oct 24 '12 at 14:38