I use dynamic SSH port-forwarding (-D) and normal SSH port-forwarding (-L or -R) for many different things, including adding a layer of encryption to my wireless web traffic. The command I use normally looks something like this:
ssh -l raam -D 9000 my-linux-server.com
After starting the tunnel, I configure my web browser to use a SOCKS v5 Proxy of 127.0.0.1 with port 9000. Now all traffic in my browser (except DNS) is transmitted through the SSH tunnel.
When I'm ready to close the tunnel (when I'm taking my laptop to another location, for example), I simply type "logout". However, the SSH session hangs and I have to press CTRL+c to get my local prompt back.
Why does this happen and how can I prevent it?
(My guess is that the connections I opened through the tunnel remain open and my local SSH client is waiting for them to close before giving me my prompt back. If this is the case, how can I force all those connections to close when I'm ready to logout?)