Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Is it possible to connect to a computer behind a router via SSH knowing only the public IP address (of the router)?

share|improve this question
What happens if you do ssh <IP> ? – Gilles Quenot Oct 2 '12 at 20:34
do you have windows? then you may need putty – Hartmut Oct 2 '12 at 20:38
It seems to load indefinitely. I'm on Debian by the way. – user24156 Oct 2 '12 at 20:39
Try ssh -v <IP> and paste it on a pastebin like pastebin.com or in your post. – Gilles Quenot Oct 2 '12 at 20:40
pastebin.com/dDxd4GjQ Here it is. Edit: It then times out. – user24156 Oct 2 '12 at 20:42

Are you the administrator of the remote machine/network?

Yes. You need to forward port 22 (or whichever port you're running ssh on) through your firewall. In addition, I suggest doing a few things to make hacking more difficult, such as switching to a different port, allowing public key only, or limiting remote connections to certain IP addresses.

Alternatively, you need to set up a VPN to get you through the remote firewall.

Alternatively, you may need to first ssh to the remote firewall, then the remote machine from there.

If you're only the administrator of that machine, not of the network, you need to ask the network administrator.

No. You need to ask the administrator of the remote machine/network how to access it, and if he/she doesn't know, suggest he/she set up one of the above.

share|improve this answer

Regarding your ssh output http://pastebin.com/dDxd4GjQ it seems like ssh isn't open on default port 22 on the remote host. (possibly no ssh at all, or a firewall is protecting it).

If you have authorisation, you can scan the ports of this host to see if there's a binding ssh port on another port.

Something like :

nmap -sS <IP>
share|improve this answer
Isn't the host a router ? I mean, the public IP leads to the router that then leads the connection via the private network IP to the computer ? – user24156 Oct 2 '12 at 20:54
@Zack Dibe - You should edit your question to provide some more information about what you are trying to connect to. If it's a machine behind a router, then that's a different problem from connecting directly. – ire_and_curses Oct 2 '12 at 21:23

Your Answer


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