Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Thanks

share|improve this question

migrated from stackoverflow.com 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

2 Answers 2

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

 
discard

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