SSH to a remote computer having only the public IP

41,355

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:
41,355

Related videos on Youtube

tshepang
Author by

tshepang

I do software development for a living and as a hobby. My favorite language is Rust, and I've used Python much in the past. My OS of choice is Debian.

Updated on September 18, 2022

Comments

  • tshepang
    tshepang almost 2 years

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

    • Admin
      Admin almost 12 years
      What happens if you do ssh <IP> ?
    • Admin
      Admin almost 12 years
      do you have windows? then you may need putty
    • Admin
      Admin almost 12 years
      It seems to load indefinitely. I'm on Debian by the way.
    • Admin
      Admin almost 12 years
      Try ssh -v <IP> and paste it on a pastebin like pastebin.com or in your post.
    • Admin
      Admin almost 12 years
      pastebin.com/dDxd4GjQ Here it is. Edit: It then times out.
  • Admin
    Admin almost 12 years
    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 ?
  • xrfang
    xrfang almost 12 years
    @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.