SSH is a secure shell that allows you to access your Raspberry Pi from a remote location. SSH is used to connect to your Raspberry Pi from a remote computer, such as a workstation or server. You can use SSH to connect to your Raspberry Pi in many ways, including using the ssh command. To use SSH on your Raspberry Pi, you first need to install the ssh command on your computer. You can find the ssh command on most computers by searching for it in the Windows search box or by typing it into a terminal window. Once you have installed the ssh command, you can use it to connect to your Raspberry Pi. To do this, you need to type the following into a terminal window: ssh pi

What Is SSH?

SSH, often typed all in lower case, stands for Secure Shell. It allows you to remotely connect to a server or system from another device using encrypted communications.

The primary benefit of SSH is the encryption itself. With less secure remote login protocols, such as FTP, everything is sent in plain text. A hacker can sniff out those communications and log things like usernames and passwords. Since SSH is encrypted, that’s no longer possible.

RELATED: What Is Encryption, and How Does It Work?

Before You Turn On SSH, Mind Your Security

Turning on SSH is easy, but let’s not get ahead of ourselves. First, you’ll want to make sure your Raspberry Pi is secure. That starts with the password for your user account.

When you first set up your Raspberry Pi, you should have been prompted to change your user account password. If you did not, you need to do so now. Open the terminal, then enter the passwd command.

You’ll be prompted to enter your current password, then choose a new one.

RELATED: 10 Ways to Generate a Random Password from the Linux Command Line

Discover the IP Address or Hostname for Your Raspberry Pi

You’ll also need to know the hostname or IP address of your Pi. From the terminal, type:

This will provide the IP addresses for your Raspberry Pi. There could very well be several listed if you are connected both through Wi-Fi and Ethernet. Most of the time, the address you want will begin with 192.168. Make note of the address or hostname for later.

With that out of the way, we can turn on SSH.

RELATED: How to Setup Wi-Fi On Your Raspberry Pi via the Command Line

Option 1: Enable SSH Through the Desktop

One way to turn on SSH is through the Raspberry Pi graphical configuration app. Just click the Raspberry icon in the top left corner of the screen, then click “Preferences.” Click “Raspberry Pi Configuration.”

In this app, click the “Interfaces” tab and look for “SSH.” Click the “Enable” radio button, then click “OK” to close the app.

Option 2: Enable SSH From the Terminal

Another method to enable SSH is from the terminal itself, command-line style. Type this command to enter the text-based configuration tool for your Raspberry Pi:

Use the arrow keys on your keyboard to select “Interfacing Options,” then press the Enter key.

Select “P2 SSH” and press Enter.

When asked, “Would you like the SSH server enabled,” choose “Yes.” Press Enter again at the confirmation box, “The SSH server is enabled. Navigate down and select “Finish.”

Disable SSH Root Login

Once you’ve enabled SSH, there is another optional but highly recommended task. Leaving your root user able to SSH into your Raspberry Pi is a security risk, so we recommend disabling root login through SSH. Remember, you can always issue administrative commands from your regular user with sudo.

In your Terminal window, enter this command:

Now, find this line:

Edit the line to read as follows:

Save and close the file by pressing Ctrl+X, then Y . Now, you should reboot the SSH server with this command:

There are other steps you can take to secure your SSH server even further, so be sure to consider how at-risk your Raspberry Pi can stand to be.

Log Into Your Raspberry Pi From Another Computer

Once those steps are complete, you’re ready to log into your Raspberry Pi from any computer on your local network. With the IP address or hostname you noted earlier, you can ssh into your Pi. That’s done using this command from your other computer:

If your Raspberry Pi’s address is 192.168.0.200 , for example, it will look like this:

The first time you ssh into your Pi, you’ll be asked to accept the encryption key. Just press Y , and you’ll connect and be prompted to enter your password. That done, you’ll be logged into the Raspberry Pi and can do whatever tasks you need.

In addition to issuing commands, you can also use SSH for other purposes, such as to tunnel your traffic, transfer files, mount remote file systems, and more. If you’re concerned about security with your Pi, consider setting up two-factor authentication.

RELATED: How to Set Up Two-Factor Authentication on a Raspberry Pi