Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.