I set up a reverse-ssh tunneling connection from my local machine to a remote server using the following ssh config setup
Host remote RemoteForward 2222 localhost:22 Hostname 192.168.1.111 User user ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes XAuthLocation /opt/X11/bin/xauth I then ssh into the remote machine via ssh remote. From the remote machine I'm trying to run a command on my local machine by, say:
ssh -n localhost -p 2222 "while true ; do sleep 1 ; date ; done" When I press Ctrl-C, the ssh connection is lost. However, the process for while true ; do sleep 1 ; date ; done keeps running on the local machine. How is it possible to relay the Ctrl-C (SIGINT) to the local machine?
I realize my question is similar to such as: Ctrl-C handling in SSH session How is Ctrl+c or Ctrl+z sent over SSH?
However, I can't use -t to prevent ssh from catching the Ctrl-C. If I type:
ssh -t -n localhost -p 2222 "while true ; do sleep 1 ; date ; done" I get:
Pseudo-terminal will not be allocated because stdin is not a terminal.
-n…-n.-t(as mentioned at the link I gave above).