Recently I found out about a service called ngrok that allows you to connect to your home server using public access points. The cool thing here is that you can specify certain ports. With ngrok setup correctly you can reach your server services from anywhere. In this tutorial I will be using SSH. If you do use this guide, please make sure to secure the port you are exposing to the open internet.

Initial Setup

The first step is to create an account here. Once you get an account go to this page. You will see the commands required to add your API key to the default configuration.

Download the binary on the server of your choice and expand it. Then add in the API key.

curl 'https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.tgz' -o ngrok.tgz
tar -xvf ngrok.tgz
./ngrok authtoken yourapikeyhere 

Open Port 22

Now we will open port 22 to ngrok to be publicly accessible.

./ngrok tcp 22

It will output the URL for you to connect to. Here was my output:

ngrok by @inconshreveable                                       (Ctrl+C to quit)
                                                                                
Session Status                online                                            
Account                       xadlien (Plan: Free)                              
Version                       2.3.40                                            
Region                        United States (us)                                
Web Interface                 http://127.0.0.1:4040                             
Forwarding                    tcp://8.tcp.ngrok.io:13969 -> localhost:22

Notice the tcp://8.tcp.ngrok.io:13969. Using this we can connect to the server publicly.

ssh -p 13969 8.tcp.ngrok.io

This address will change every time you restart the program.

Unit File

I have created a setup script for a systemd service that will run at boot and email the access endpoint. All of that setup can be found here.