Skip to content

rTerm Agent on Raspberry PI

Overview

It is common to use SSH to access Raspberry PIs, but SSH only works when devices are on the same network. To removely access a Raspberry PI a VPN or advanced networking is needed. rTerm can help especially in this case. Once the rTerm Agent is installed, the PI can be access from any network as long as it is online.

This example will walkthrough how to setup both the PI and a computer to access the PI.

Raspberry PI Setup

Prerequisites

In order for rTerm Agent to authenicate with the PI, this tutorial assumes that the user can SSH (using ssh keys) in to their PI and the public key is in the ~/.ssh/authorized_keys file. By default, rTerm Agent will use public keys inside of this file to authenticate requests (similar to how SSH works today).

Install & Run rTerm Agent

To install rTerm Agent on the PI run the following command:

  curl https://t.rterm.io/dist/rterm-agent/pi4/install.sh | bash

or (x64 ARM)

curl https://t.rterm.io/dist/rterm-agent/pi4/install.sh | bash -s pi4-x64

To run the rTerm Agent, run ~/rterm/rterm-agent from the PI. This will provide a unique sessionId to use to connect to the PI. Note the sessionId that is presented to the screen and copy it to the machine that will be used to access the PI.

Note: To run rTerm Agent as a service, run ~/rterm/install-service.sh. This will run the rTerm Agent all the time and after reboots.

Accessing the PI

Install rTerm CLI

Once the rTerm Agent is running, the PI can be accessed using the rTerm CLI. To install the CLI to your machine see the instructions on the rTerm CLI page. Make sure to setup the RTERM_PRIVATE_KEY_PATH as noted on that page.

After the rTerm CLI is installed, run the following command to connect to the PI:

~/rterm/rterm-cli <sessionId>

Note: For long term use, copy the rTerm CLI to /usr/local/bin or other convenient locations.

Bonus: Access with rTerm Web CLI

Once the rTerm Agent is running on the PI, it can also be access using the rTerm Web CLI. This connection also requires that public/private keys are setup. The one execption here is that the rTerm Web CLI will provide unique keys for you. Note: These keys are generated by your local browser using window.crypto functionality supported in most browsers

Browse to https://rterm.io to load the rTerm Web CLI. Once there, a key icon will be in the upper right hand corner. Clicking this key, will present the public key on the screen (the private key is not exposed). Copy this public key to the ~/.ssh/authorized_keys on the PI.

After the public key is on the PI, browse to the following URL (also shown by the rTerm Agent):

https://rterm.io/?sessionId=[sessionId]

The sessionId is the same sessionId provided to the rTerm CLI. Note: The sessionId will change everytime the rTerm Agent is loaded.

After the rTerm Web CLI is paired with an initial sessionId, it will be available in the dropdown on top of the rTerm Web CLI page.