SSH (Secure Shell) is a network protocol that provides secure encrypted data transfer between two computers on the same network.
It was originally designed by the CERT at Carnegie Mellon University in 1995 as an alternative to Telnet, which transmits all user input and output unencrypted.
The original goal of SSH was to provide secure remote access to computers running Unix-like operating systems such as Linux or FreeBSD.
If you want to find out how to connect to your Raspberry Pi over the internet using SSH, read on!
What Is Raspberry Pi?
Raspberry Pi is an inexpensive computer designed for use as both a hobbyist project and educational tool.
It was originally released by UK company, The Raspberry Pi Foundation, and has been developed ever since, primarily for use as a platform for learning about Linux and programming.
Although it may not initially seem like much, Raspberry Pi contains a Broadcom BCM2835 single-core ARMv6 CPU at 1GHz, 128MB RAM, 4GB eMMC storage, and VideoCore IV GPU running OpenGL ES 2.0.
It is ideal for home computing, as it has enough power – yet is small enough to carry around.
What Software Do Raspberry Pi’s Come With?
Raspberry Pies preloaded with their operating system are usually around 8 GB in size.
This includes everything you need to get started right away, including programs and applications for various functions, such as networking, playing games, making music, and interacting with the world around us.
The most common program found on a Pi is the XBMC Media Center, which lets you watch movies, listen to music, play video games, browse the Internet, surf social media websites like Facebook, Twitter, YouTube, and Reddit, as well as offer the chance to download many different types of media.
Another popular option tends to be RetroPie – this is free and allows users to emulate classic retro gaming platforms like NES, Sega Genesis, SNES, Game Boy Advance, Super Nintendo Entertainment System/System 16, GBA SP, Neo Geo Pocket Color, Nintendo 64, Atari 2600, ColecoVision, Amiga 500, ZX Spectrum and others.
A third popular tool to use on many Raspberry Pi’s is Node-RED, which makes it easy to create interactive visualizations, flow charts, or data dashboards for IoT devices, mobile apps, and data analysis based on real-time sensor input.
It’s also very useful for debugging any kind of hardware issues, such as connecting multiple sensors together for monitoring air quality, temperature, humidity, light level, or just a simple smoke detector.
Finally, you might enjoy a simple HTML5 game such as Angry Birds, Snake, or Fruit Ninja. Overall, Raspberry Pi’s offer a solid, versatile system, which has a lot to offer users.
How To Connect Raspberry Pi To Internet Using SSH
The steps below will help you configure your Raspberry Pi so it can be accessed remotely through SSH:
Install OpenSSH Server On Raspberry Pi OS
SSH should be installed on all Raspberry Pi operating systems by default. To check, run this command:
Go to the “Interface options” section, and make sure that SSH is enabled. If so, great – and if not, enable it!
Start SSH service
You must start the SSH service before you can log into your Raspberry Pi remotely using SSH. Run one of these commands depending on whether you want to log in as root or not.
[email protected]:/home/pi systemctl status sshd.service
[email protected]:/home/pi service ssh start
Log Into Raspberry Pi Via SSH
Once you have started the SSH service, you can now log into your Raspberry Pi using SSH. For example, if you are logged into your Raspberry Pi locally, type this command:
Connect To Raspberry Pi Over Internet
Now that you have successfully connected to your Raspberry Pi over SSH, you can use any standard terminal emulator application to connect to your Raspberry Pi over the Internet.
Popular applications include PuTTY, Tera Term, Putty, and XTerm.
Disconnect From Raspberry Pi
When you no longer need to access your Raspberry Pi, simply disconnect from your Raspberry Pi. You can do this by typing exit after logging into your Raspberry Pi remotely.
Remove SSH Keys
After you have completed configuration and testing of your new connection method, remove the public key file from your Raspberry Pi. This prevents others from accessing your Raspberry Pi without a password.
Reboot Raspberry Pi
Reboot your Raspberry Pi to ensure the changes take effect.
Test SSH Connection
Now that you have configured your Raspberry Pi to allow remote connections, test your newly created SSH connection.
Type the following command to check if your Raspberry Pi has been properly configured to accept remote connections:
Delete files on your Raspberry Pi using the rm command. For example, to delete a text file named “testfile”, type:
Copy files on your Raspberry Pi to other locations using the cp command. For example, copy all the files in the current directory to the home directory. To do so, enter:
cp -R * ~/Desktop/
Create directories on your Raspberry Pi using mkdir. For example, create a directory named “myfolder” on your Raspberry Pi:
Rename files on your Raspberry Pi by entering the mv command. For example, rename a file called “testfile“ to “newfilename“. Enter:
mv testfile newfilename
Frequently Asked Questions About SSH
The Secure Shell (SSH) protocol was originally developed by the OpenBSD project in 1995. The first version of SSH was released in 1997.
In 2001, the RSA Laboratories team at MIT began working on an improved version of SSH known as SSH1. SSH2 is the latest version of SSH.
How Does SSH Work?
SSH uses two distinct protocols: the secure shell (SSH) protocol and the transport layer security (TLS) protocol.
The SSH protocol provides encrypted data transmission between computers while the TLS protocol encrypts traffic during the session. Both protocols operate independently of each other.
What Is The Purpose Of SSH?
The purpose of SSH is to provide secure remote access to a computer. When used with a firewall, SSH allows users to log onto a server without having to use a username or password.
Who Invented SSH?
The original inventor of SSH was Eric Allman, who worked for the OpenBSD project. He wrote the first version of SSH in 1997.
Why Should I Use SSH?
Using SSH will prevent unauthorized persons from gaining access to your computer by guessing your username and password. It will also protect your computer against viruses and worms.
Is SSH Safe?
Yes. SSH is designed to be very secure. The only way someone could gain access to your computer through SSH would be if they had physical access to your computer. If you are concerned about security, then you should not use SSH unless it is absolutely necessary.
SSH vs VNC
VNC stands for Virtual Network Computing (see also ‘How To Enable VNC On Raspberry Pi‘). You may have heard of it before because many people use VNC to view their desktop remotely (see also ‘What Is AnyDesk Used For?‘). However, there are several differences between VNC and SSH.
First, VNC requires a local connection to the computer being viewed. This means that the viewer must be physically connected to the computer being viewed when viewing the screen.
Second, VNC doesn’t support multiple simultaneous connections. Third, VNC isn’t encrypted.
Fourth, VNC has no built-in authentication mechanism. Finally, VNC runs on top of TCP/IP which makes it vulnerable to attacks such as buffer overflows.
SSH vs Telnet
Telnet is another network service that allows you to log into a computer remotely. Like SSH, Telnet can be used to connect to any computer running the telnet daemon. Unlike SSH, Telnet is unencrypted so anyone can see what you type.
Also, Telnet is insecure since anyone can guess your username and password.
SSH vs RSH
RSH stands for Remote Session Host. RSH is a program that allows you to run commands on a remote computer using the SSH protocol. RSH is similar to SSH except that it is much faster than SSH.
Hopefully with this guide you’ve learned how to use SSH to make a remote connection to your Raspberry Pi!