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 want to connect to my computer(local) behind NAT through public accessible server(public).

On local: ssh -g -R 8000:localhost:22 user@public

Then on public: ssh -p 8000 user@public But I am getting error: Connection refused.

When I login to public server I can verify that tunnel is working by: ssh -p 8000 localhost Which opens ssh on local computer.

I am suspecting wrong that public server should act as transparent proxy? Or how to make it working like that.


share|improve this question

migrated from Nov 20 '09 at 18:33

This question came from our site for professional and enthusiast programmers.

Ask on server fault. – user23758 Nov 20 '09 at 11:14
Does public has a firewall blocking port 8000 ? Try on port 443. – Tristram Gräbener Nov 20 '09 at 11:14

According to the manual, you may, on the public host, set the option (in sshd_config):

GatewayPorts yes

and then on local try

ssh -R *:8000:localhost:22 user@public

(note the extra *:).

If you do not have access to public's sshd_config, you may make an extra port forward like so:
on local (lancomp): ssh -R 8001:localhost:22 user@public
on public: ssh -g -L 8000:localhost:8001 user@lancomp

And to connect from outside, of course, in both cases: ssh -p 8000 user@public

share|improve this answer

The listing on port 8000 will be made on the localhost address of the public macine only. If you want it to bind to the "real" network interface, you might try -R public:8000:localhost:22.

share|improve this answer

Your Answer


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