How To Raspberry Pi

Use to access your Raspberry Pi from internet

A Raspberry Pi

How to configure on Raspberry Pi

We’re going to explore 3 options on how to configure;
a) A random subdomain
b) A custom subdomain
c) A custom domain

a) A random subdomain

A custom subdomain is as easy as runnig the below command

ssh -R mysubdomain:80:localhost:8888

If your chosen subdomain is available, you will get the below success message.

Success message for random subdomain creation using
A random subdomain has been created
b) A custom subdomain

Run the below command, replace mysubdomain with your desired subdomain, that’s it.

ssh -R mysubdomain:80:localhost:8888
A custom subdomain creation success using
A custom subdomain has been created
c) a custom domain

This one is tricky and lengthy, so follow along.

a) Create an SSH key pair

We will first move to default user directory and then create a key pair using ssh-keygen. Run the below commands.

cd ~

You will be asked to enter the file name to save to, type in a filename as desired, for this example we’re going to use the name “mysiteKeyPair”.

Next you will be asked for a passphrase will be used to encrypt the key pair. Choose a passphrase and then re-enter to confirm.

The key fingerprint would be generated as shown below,

Message on termnal when generating a SSH Keypair
Generating an SSH keypair

In the image the, fingerprint is “SHA256:LAoEEFN5qe9tEFJpZ+dJ+Ios2xdFdzLFhVFkvhe11Os.

b) Add DNS records to your domain

We need to add two records to the domain. You will need to go to your domain name provider (GoDaddy, BigRock, etc.) and

  1.  Add an A record pointing to
  2. Add a TXT record in form for authkeyfp=[fingerprint]. For example, in the above key the DNS Record will be


Now we can request the connection using the below command.

ssh -i mysiteKeyPair -R

Type yes and hit Enter when you get the below message.

Confirmation message while using ssh to login
RSA fingerprint confirmation

Now you can access the website by typing https//, replace mysite with the domain of your choice.

We can further supercharge this by using autossh to ensure any issue with the connection is fixed automatically and also start he script on boot.

We do that in next page.

ALSO READ  How to Open and edit PDF files using MS Word

Leave a Reply

Notify of