Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have two computers both running Linux. Let's call them computer A and computer B. Computer A has IP and B has

On computer B there is a JBoss 7 AS installed and its admin interface is just accessable locally (on and I would like to access it from computer A.

Therfor I would like to SSH tunnel to computer B from computer A and forward all traffic to another port that is open on B, let's say I would forward incomming HTTP requests on port 8081 on B to

How can I establish such a tunnel from computer A to computer B?

I followed this guide but failed:

share|improve this question
up vote 2 down vote accepted

On computer A:

ssh -fCNL 8081:localhost:9990 username@

Or reverse port forward from computer B (don't use both simultaneously):

ssh -fCNR 9990:localhost:8081 username@

For understanding the options see man ssh

share|improve this answer
Thanks! I will try that tomorrow at work. Will accept the answer tomorrow if I succeed. :-) – Rox Nov 19 '12 at 18:08
On a normal network the -C option will just slow things down. – rorycl Nov 19 '12 at 21:04
For me the CPU overhead from -C is negligible. Desktops and servers can handle gzip compression/decompression very easily and embedded devices usually turn off this feature. On the other size, network load is significantly lower especially on port forwarding (often is uncompressed/plaintext data). – Dmitry Vasilyanov Nov 19 '12 at 22:25

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.