In our interconnected digital age, it’s crucial to access our devices securely from any location. This guide will walk you through setting up a VPN with Tailscale, facilitating a seamless and secure connection between an Ubuntu desktop (acting as the server) and a MacBook.

For those in a hurry, jump straight to the instructions. If you’re curious, here are some Q&As:

Setting this up might seem daunting, so I use Tailscale to make my life easier.

Install Tailscale

First, install Tailscale on both your SSH server and client. MacBook users take note: There are three methods to run Tailscale on macOS. For an enhanced user experience, please install the open-source Tailscale & Tailscaled CLI version. The GUI version, unfortunately, doesn’t operate in the background.

All the installation instructions can be found here.

Connect Your Devices and Set Up Tailscale SSH

After installation, connecting your devices is straightforward. Just follow the on-screen instructions.

This guide uses Tailscale’s SSH service for the connection, which is both user-friendly and secure. Dive deeper into the nuances of Tailscale SSH.

However, if you prefer, you can use the OpenSSH Server and client paired with the Tailscale VPN instead of Tailscale’s SSH service. This approach is slightly trickier to configure securely.

On Ubuntu:

sudo tailscale up --ssh

On Mac (with the Tailscale CLI version):

tailscale up

Once you’ve linked the devices, you’ll see an output resembling the following: tailscale_dashboard The IP address is auto-allocated by Tailscale once your device gets connected. (and for sure it’s not Lol)

Connect Your Devices in IDE

Once you get there, in your client device terminal, use the below command to connect:

ssh <username>@<server device vpn ip adress>

Replace <username> with a valid user from your SSH server system.

If you’ve managed to connect successfully using SSH, you might want to set up an SSH connection within your favorite IDE for a smoother remote development experience. Personally, I use vscode, and you can find setup instructions here.

Here’s a glimpse of the vscode SSH connection terminal on my laptop: