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

that's the simple scenario: from pc A i open a tunnel SSH to a pc B. Can someone, on pc B, use this tunnel to enter or forwarding some protocol to pc A? Can i limit traffic to be generated only from pc A? Thanks.

share|improve this question
You haven't specified what tunnel you've created. Please give an example. – MikeyB Sep 9 '11 at 14:51
ssh -L localPort:remoteHost:remotePort user@SSHserver (ssh server and remote host are the same) – John Sep 9 '11 at 15:03
up vote 1 down vote accepted

I'm assuming you're talking about an SSH port-forward "tunnel" -- If you run (for example) ssh -L 8080:B:80 user@B on host A and haven't done anything funky to your SSH configuration the answer is that there is no risk of "backwash" from host B.

The command above opens a listener on host A's local loopback address ( / ::1) on port 8080.
When you send traffic to to that listener it is sent over the SSH connection to the other side to Host B port 80.
Replies from host B will travel back along the tunnel, but host B cannot initiate new connections back to host A -- it is a single port forward, not a wide-open tunnel.

Regarding the second part of your question (limiting traffic), by default SSH binds forwarded ports to localhost, so if you use the command above host A is the only one that can use the connection. The full syntax for the -L option is -L LocalIP:LocalPort:RemoteHost:RemotePort, however the LocalIP part is typically omitted and defaults to localhost.

For more information consult the OpenSSH man pages.

share|improve this answer
Yes, it's a port-forward tunnel and i use the -L option. Thanks for answer. – John Sep 9 '11 at 15:01

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.