Super User is a question and answer site for computer enthusiasts and power users. 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'm new to this stuff, but I am trying to set up an ssh server in Ubuntu. I am able to log in locally to the server, but when I am off the network, I get "port 22: Connection Refused".

Having spent a long time reading forums and configuring things, I have come to believe that it is because I have not performed any port forwarding. Is this necessary even though I ONLY have a modem with one ethernet cable out to my one computer on this network? If so, what will port forwarding do that isn't already going on? Furthermore, is port forwarding even possible using a dynamic ip address (which I have)?

Thank you! -Matt

share|improve this question

No, you probably don't need port forwarding and yes, port forwarding would work also with your dynamic address.

You would need port forwarding only if you have a router, then the request would arrive through the modem at the router with the modem's external IP - dynamically given by your ISP - to some port you want to access (22 for ssh) and you would have to redirect at the router this port to some internal IP and port.

In your case I think it is more a problem of a firewall running on your server, or some sshd security configurations not allowing you access from external IPs.

Do you have a firewall running? Under Ubuntu you can open the ssh port with

sudo ufw allow 22

Check .

Be careful with the security implications of opening ports to external access. In the case of ssh, if you want to be on the secure side, check that root access is disabled and enable only PubkeyAuthentication and disable password only authentication unsetting ChallengeResponseAuthentication .

Carefully read

man sshd_config
share|improve this answer
hmm. Thank you for the quick response, I had previously disabled ufw altogether in favor of gufw on which I had unblocked port 22, but I tried your suggestion anyway. Still no luck... I also read all of man sshd_config, and thought setting the "GatewayPorts" variable to "yes" would do it, but nothing. Then I tried disabling PAM (enabled by default on my system), but that seemed to do nothing... – mag725 Feb 9 '11 at 19:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .