Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
1  
What happens if you do ssh <IP> ? –  sputnick 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. –  Zack Dibe Oct 2 '12 at 20:39
    
Try ssh -v <IP> and paste it on a pastebin like pastebin.com or in your post. –  sputnick Oct 2 '12 at 20:40
    
pastebin.com/dDxd4GjQ Here it is. Edit: It then times out. –  Zack Dibe Oct 2 '12 at 20:42
add comment

2 Answers 2

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
add comment

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 ? –  Zack Dibe 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
add comment

Your Answer

 
discard

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.