I need to make a tunnel from Linux to my Windows 7 machine. I have been able to get it to work with Cygwin, but it's not possible to remove the tunnel later.
To create the tunnel, I type:
ssh -f -N -L 5001:localhost:3306 target
The tunnel goes up with no issues. However, there doesn't seem to be a way to kill it. TCPView shows the process as <non-existent>
, but does give a ProcessID. The ProcessID has already terminated and if I right-click and select "Close Connection". Nothing happens.
Short of a reboot or network enable/disable, what can I do to get rid of this tunnel?
I don't use Cygwin that often, but try checking to see if the ssh process or any of its children still have open files. If Cygwin has an lsof port, you can use that, but if not, you can also try Process Explorer, or maybe dig around in the /proc//fd directory.