I am trying to SSH into a ubuntu desktop that is constantly running a vpn service - think nordvpn. Because the vpn 'changes' my IP address, this seems difficult to me. I am a complete beginner in this realm. Thanks.

  • 1
    From inside your network? Or outside? – user553512 Jul 22 '19 at 15:20
  • Preferably from outside. I guess I could also get a RPI and tunnel to it from external sources, and then pass the ssh to the ubuntu desktop (If this is needed to SSH from outside the network). Additionally, I would want to sometimes tunnel to it from inside the network. – starter1011 Jul 22 '19 at 15:48

You might be interested in trying a Dynamic DNS solution. This is where your system updates a DNS entry every time it starts up, or whenever the WAN IP has changed. This has the benefit of allowing you to use a DNS record instead of a [changing] IP address that can easily be added to your ~/.ssh/config. Please understand that DNS entries have TTL values that can delay updates to the IP. This delay is, by default, 300s, or 5m.

Typically, you find a Dynamic DNS provider, create an account, and follow their instructions for setup. Alternatively, if you use a hosting provider such as Linode, you could write your own script to provide this functionality. More details on how to easily set up Dynamic DNS with existing solutions are available in the Ubuntu Community - DynamicDNS document.

Be warned! You are using this VPN service [assumingly] for anonymity. You are suggesting that you wish to enable your sshd service to listen on your VPN IP. Do you really want to open your machine up to anonymous access? You probably don't want to do that, for your own security.

  • I see your point, thank you for the detailed information. Could I ssh to a RPI and then ssh to my desktop on the same network - even though the desktop is using a vpn - and retain my anonymity? Thank you! – starter1011 Jul 22 '19 at 17:35
  • Your goal isn't quite clear to me. If you can login anonymously, so can others. Can you explain why you can't just use your ISP WAN IP to connect to your machine? – earthmeLon Jul 22 '19 at 19:24
  • I want to be able to run bash commands from any location/other pc to execute scripts and get certain data using my home ubuntu desktop which needs a vpn to access said data. i thought using a ssh would be the best way to access my ubuntu desktop – starter1011 Jul 23 '19 at 15:01
  • hi, was wondering if you would suggest anything for my situation? – starter1011 Jul 26 '19 at 19:09
  • Question your need for remote access to the system, and what that means. Consider a 5$ VPS, such as DigitialOcean or Linode. Alternatively, Use DynamicDNS to set a DNS entry to a known domain name, to either the VPN or WAN IP, with proper port forwarding to the destination machine. Prefer WAN over VPN access so you can audit your logs and not open access to a LAN of other anonymous users. – earthmeLon Jul 31 '19 at 17:47

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.