My friends use Ubuntu 16.04 and I use Fedora 27. They're new to Linux, and they ask me for help now and then. Rather than helping them over video calls and stuff, I find it easier to have remote access to their systems via SSH (I've performed this few times when we were connected on the same network, but never when we've been apart). I don't have an internet connection at home. Instead, I turn on my mobile hotspot, and connect my laptop to that. Keeping this in mind, how can I use SSH to login to their systems when we're in two different locations and connected to different networks? (I know I should probably be asking this on the Fedora forums, but I assume that the instructions for Ubuntu and Fedora in this matter will be the same).

  • You could use also TeamViewer or VNC Connect, or any other similar third party free app that uses intermediate server.
    – pa4080
    Dec 18, 2017 at 17:14

2 Answers 2


If you are on two different locations (assuming two different public IP Addresses), Remote User's Router have to have an entry for port forwarding from source port any -> 22 or source port 22 -> 22 for the Linux Host (hostname or IP Address). Assuming the linux host is accepting ssh connection at port 22 or use whichever port is configured for ssh.

Whenever you will try to ssh using their Public IP Address, their router will accept the request and based on the port forwarding entry, packet will be destined to the correct host (linux host). In this scenario, your public IP Address does not matter. Either you obtain it using Hot Spot or anything else. As long as you have access to the internet, you should be able to SSH using their Public IP Address or DNS namespace if using DDNS

If you do SSH too often and dealing with the public IP Address seems to much each time, there are numerous free DDNS services you can take the benefit from. One of these is called NOIP and instructions to run on linux can be found in here

  • I think even they use their mobile hotspot. What do we do in this case?
    – Caramello
    Dec 18, 2017 at 17:05
  • I am not quite sure about cellular public IP allocations. If they are using hot spot, you can still run whatsmyip or search on google. You will get public IP Address. Again, not sure how does the Public IP Leasing works for Mobile careers, lease time could be too low or normal. When it comes to port forwarding this may not help, since you are not connected to the real network gear. if this is a vm, hosted on win based pc, try playing around with noip DUC Dec 18, 2017 at 17:08

please remember that exposing ssh to the internet carries a great risk of getting hacked. Therefore I would recommend to go with pa4080's advice and go for TeamViewer or VNC Connect or such.

If You want to work remote on another system consider setting up a dedicated VPN between the two hosts (or their respective gateways like DSL Router)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.