SSH Raspberry Pi

Raspberry Pi is a powerful tiny-computer. But how can you access it? Connecting to your devices with a secure network is a must-have tool in your arsenal. In this Article we will overview the SSH protocol and how to establish a connection to your pi.

Time to read:

4

minutes

SSH Raspberry Pi

Once you’ve set up your Raspberry Pi, you’ll still need to do regular maintenance and updates. Although you can perform these tasks on the device itself, sometimes it will simply not be possible. Other times, you’ll need to access the device remotely to do maintenance and updates. In either of these cases, you’ll typically use SSH to establish a connection with the device across the network. 

But how do you connect to your Raspberry Pi using SSH?

In this post, we’ll show you how and give you an easier and more efficient way to do this. 

What Is SSH?

Secure Shell Protocol or SSH is a cryptographic network protocol that allows you to operate network services securely over an unsecured network. Although it's mostly used for remote command-line, login, and remote command execution applications, it can be used to secure any network service. 

Considering the above, you can have remote access to your Raspberry Pi or any other Internet of Things (IoT) device. This, in turn, allows you to manage the device remotely.

With that in mind, let's look at how you can access your Raspberry Pi using SSH.

Using SSH To Access Raspberry Pi

By using SSH, you can access the command line of your Raspberry Pi remotely from another computer or device on the same network. This will give you full access to the command line of the device, which then allows you to manage it remotely. Keep in mind, though, that you won't have access to the full desktop environment. 

Your first step to enable an SSH connection with the Raspberry Pi is to make sure that your local network is set up. So, if you're using your Raspberry Pi on a wireless network, you’ll need to ensure that the device is connected to the network. You can do this by using the desktop user interface or the command line to activate the connection.

Likewise, if you're not using a wireless connection, you’ll need to ensure that your Raspberry Pi is plugged into the router. You can then make a note of your Raspberry Pi’s IP address, which you’ll use to connect to the device over the network.  

To do this you can use the ifconfig command which will give you all the information you need including the IP address. You could also use the hostname – I command to display the IP address associated with your Raspberry Pi. 

The next step is to enable SSH. As of the November 2016 release of Raspberry Pi OS, it has SSH disabled by default. You can enable SSH manually from the desktop. To do this, you should:

  • Launch Raspberry Pi Configuration from the Preferences menu.
  • Navigate to the Interfaces tab.
  • Next to SSH, you’ll then select Enabled.
  • Click OK.

Apart from the above, you can also use the raspi-config tool in the terminal. Here:

  • Enter sudo raspi-config in the terminal window.
  • Select Interfacing Options.
  • Navigate to and select SSH.
  • Choose Yes.
  • Select OK.
  • Choose Finish 

Another option is to use systemctl to start the SSH service. To do this, you’ll use the following commands:

  • sudo systemctl enable ssh, and then
  • sudo systemctl start ssh

The final step in the process is to set up your SSH client, which you’ll use to access your Raspberry Pi. SSH is built into Linux distributions and macOS by default. In contrast, it's an optional feature in Windows 10. For older versions of Windows, you'll need a third-party SSH client to access your Raspberry Pi remotely.

Another Option

The above option to access your Raspberry Pi through SSH can be quite cumbersome, especially if you have several devices that you want to have access to and manage. So, we'll give you another option that makes this process a lot easier and more efficient.

By using Upswift.io, you can completely manage any Linux-based device, like the Raspberry Pi, remotely. 

Your first step is to register a free maker account at Upswift.io. The only things you’ll need to do this is your email and a password. Once you've registered an account, you'll receive an activation email. When you click on the link in this email, your account will be activated, and you'll be able to log in. When you log in for the first time, you'll see a pop-up window that you'll have to fill in.

Now, you’ll have a choice of plans. Here, you can select the “Prototype Plan”. This plan is completely free, and you can use it to manage up to three Linux devices. Now that your account is set up and ready to go, we can connect a device.

And it’s really simple. You'll start by clicking on ‘Register Device’ at the top of the page. You’ll then be able to copy, paste, and run the installation command on your Raspberry Pi or Linux device. Once the installation is complete, you’ll see the device listed on your devices page. You’ll also note that the device is listed under a random name, but you can change this by clicking on ‘Edit details’.

Now that your device is set up, you’ll be ready to initiate the remote control session. To do this, you’ll need to click on the Remote Control icon under your Raspberry Pi. When you do, you'll see a pop-up window with a secret key that you can just copy and wait until the remote control session starts.

When the session starts, the Remote Control window appears. You can then just paste the secret key you copied earlier and then click on Connect. Once you've done this, you’ll have full access to your Raspberry Pi’s command line.

Benefits of Using This Approach

From the above, it's easy to see why using Upswift is far easier and more efficient. For one, you can connect to your Raspberry Pi from anywhere in the world, and it doesn't need to be on the same network as your laptop or desktop computer.

This means you can fix issues, install upgrades, or perform maintenance on your Raspberry Pi remotely no matter where you are. Upswift allows you to do this because it contains three tools:

  • Remote Control. It accesses a secure dedicated SSH tunnel with each of your devices, and you're given a complete set of Linux terminal commands that you can use to perform the tasks you need to.
  • Remote Access. The platform gives you a unique URL that you can use for remote access. You can then forward any port desired on your Raspberry Pi.
  • Remote Commands. Because you're able to access your Raspberry Pi from anywhere in the world, you can run remote commands on it. Upswift also allows you to control more than one device at a time, and you’ll be able to run multiple commands on many devices.

Another benefit of using Upswift is that it makes the connection to your Raspberry Pi far more secure. This is because it uses to secure SSL tunnels which close automatically after 30 seconds of inactivity.

Ultimately, Upswift makes it far easier for you to manage your Raspberry Pi and other devices remotely and securely. This, in turn, means that you save time and money.

Final Thoughts

Hopefully, this post helped show you how you can connect to your Raspberry Pi device using SSH and that there’s a better and more efficient way to do this. By using either of these methods, you’ll be able to sort out issues, do updates, and maintain your Raspberry Pi remotely. 

If you want to know more about the Upswift platform, visit our website for more details or sign up today for a free trial. At Upswift, we offer you a feature-rich set of tools to remotely manage one or more Linux IoT devices with just a few clicks.