SSH to a remote computer having only the public IP
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.
Related videos on Youtube
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, 2022Comments
-
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 almost 12 yearsWhat happens if you do
ssh <IP>
? -
Admin almost 12 yearsdo you have windows? then you may need putty
-
Admin almost 12 yearsIt seems to load indefinitely. I'm on Debian by the way.
-
Admin almost 12 yearsTry
ssh -v <IP>
and paste it on a pastebin like pastebin.com or in your post. -
Admin almost 12 yearspastebin.com/dDxd4GjQ Here it is. Edit: It then times out.
-
-
Admin almost 12 yearsIsn'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 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.