Secure remote SSH access to your IoT devices & Raspberry Pi fleet using SocketXP.
Tags: iotremotessh, iotconnectivity, managingraspberrypifleet, securetunnel
Published: 2020-06-17 04:08:29

In this article, we'll discuss how to use [SocketXP IoT Remote SSH Access solution](https://www.socketxp.com/iot/remote-access-iot-ssh-over-the-internet/) to SSH into your IoT or Raspberry Pi fleet.

<h2>What is SocketXP</h2>
[SocketXP](https://www.socketxp.com) is a <code>cloud based [secure SSL/TLS reverse tunnelling service](https://www.socketxp.com/iot/create-secure-reverse-ssh-tunnel-to-raspberry-pi/)</code>that provides remote SSH access to your IoT devices. 

SocketXP solution does not require any changes to your firewall or gateway router configuration. SocketXP creates a [secure SSL/TLS reverse tunnel through your firewall and NAT and over the internet](https://www.socketxp.com/iot/create-secure-reverse-ssh-tunnel-to-raspberry-pi/) to your IoT devices for remote SSH access.

SocketXP is a cloud based massively scalable IoT Gateway solution that can provide connectivity to more than 10,000 IoT devices for a single user account.

<code>SocketXP solution is trusted by thousands of end users including small and medium size enterprises, business owners, developers and Raspberry Pi geeks and DIY kind of folks.</code>

<h2>How SocketXP IoT Remote SSH solution works</h2>
Install a simple, secure and lightweight SocketXP IoT agent on your IoT device (or Rasperry Pi). The SocketXP agent will securely connect (using a SSL/TLS tunnel) to the SocketXP IoT Cloud Gateway using an authentication token. You could then SSH into your device from the comfort of your browser by visiting our SocketXP IoT Cloud Gateway Portal. 

![SocketXP IoT Remote SSH & Raspberry Pi Remote SSH](https://dev-to-uploads.s3.amazonaws.com/i/5sbcb4bbn1gxfkx9v5m4.png)

<h3>Step 1: Download and Install</h3>
Download and install the SocketXP IoT agent on your IoT device or Raspberry Pi device from <a href="https://www.socketxp.com/download/>here</a>

<h3>Step 2: Get your Authentication Token</h3>
Sign up at https://portal.socketxp.com and get your <code>authentication token</code>.
![Auth Token from SocketXP Portal](https://dev-to-uploads.s3.amazonaws.com/i/itqgo26bfl4artja6qnt.jpg)

Use the following command to login to the SocketXP IoT Cloud Gateway using the auth token.
<pre>
$ socketxp login [your-auth-token-here]
</pre>
<h3>Step 3: Create SocketXP SSL Tunnel Endpoint for Remote SSH</h3>
Use the following command to create a secure and private SSL tunnel endpoint at the SocketXP IoT Cloud Gateway.

<pre>$ socketxp connect tcp://localhost:22

TCP tunnel [test-user-gmail-com-34445] created.
Access the tunnel using SocketXP agent in IoT Slave Mode
</pre>

SocketXP doesn't create any public TCP tunnel endpoints that can be connected to by any SSH client on the internet. 

SocketXP private tunnel endpoints are not exposed to the internet and can be accessed only using the SocketXP agent (using the auth token of the user) or through the XTERM terminal in the SocketXP Portal page using a web browser.

Follow the steps below to access your IoT or RPi device from the comfort of your browser.  We have used XTERM to connect to your IoT devices from our portal page via a browser from any device - laptop/desktop/tablet/phone - Android/IOS anything works.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xim6gswi1dkntcxjh19q.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dqhggb3evpmep63dq89a.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/guzkc38pcnj9ufdbphce.jpg)

<h3>SocketXP Single-Touch Installation Option:</h3>
The 3 step instruction explained above to setup SocketXP on your IoT device is a tedious process, if you got thousands of RPi to install, configure and manage.

With this mind, SocketXP IoT Solution also provides a single-touch installation for installing and configuring SocketXP IoT Agent on large number IoT or RPi devices.  

Copy paste the below single command into the terminal of your IoT devices and it will install/configure/setup and bring up the devices online in our SocketXP portal.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/i8s8rezch191o6bny0jp.png)

<h3>Configuring SocketXP agent to run in slave mode</h3>
First download and install the regular SocketXP agent software on your accessing device (such as a laptop running Windows or Mac OS). Next, configure the agent to run in slave mode using the command option <code>--iot-slave</code> as shown in the example below. Also, specify the ID of the IoT device you want to connect to, using the <code>--iot-device-id</code> option.
<pre>
$ socketxp connect tcp://localhost:3000 --iot-slave --iot-device-id "DEV0000000123"

Listening for TCP connections at:
Local URL -> tcp://localhost:3000
Accessing the IoT device from your laptop
</pre>
Now you can access your IoT device’s SSH server using the above SocketXP local endpoint, instead of a public endpoint, as shown below.
<pre>
$ ssh -i ~/.ssh/john-private.key john@localhost -p 3000
We recommend using SocketXP Private TCP Tunnels for all your remote IoT device access needs. Public TCP tunnels can be used for hobby usecase, quick testing or one-off accesses.
</pre>
<br><br>
<h2>SocketXP Scaling and Performance</h2>
SocketXP IoT Gateway easily supports more than 10K device per customer account. SocketXP IoT Gateway also has the built-in capability to grow on demand, as it is a cloud based SaaS service.

![SocketXP IoT Remote SSH Solution Scales upto 10K devices per user](https://dev-to-uploads.s3.amazonaws.com/i/b81ewe9sqq3gzb0j2u16.png)
<br>

<h2>Conclusion:</h2>
The solution discussed in this article is a secure method to remote SSH into your home or office computer because the data is encrypted using SSL.

SSH uses the same cryptography technology used by banks and governments to exchange highly confidential data over the internet.

The data transferred gets encrypted end-to-end between the SSH client and the SSH server.

SocketXP has no way to decrypt or eavesdrop your encrypted data without knowing your SSH private keys. SocketXP merely acts as an online [reverse proxy server](https://www.socketxp.com/iot/create-secure-reverse-ssh-tunnel-to-raspberry-pi/) for your encrypted data traffic transmitted through the SSH connection.

<b>This article was originally published at: <a href="https://www.socketxp.com/iot/remote-access-iot-ssh-over-the-internet/">SocketXP IoT Remote SSH Access Raspberry Pi Remote Control</a></b>