Connecting your Raspberry Pi to the World Wide Web

Learn how to securely access and control your Raspberry Pi remotely using SSH. This tutorial will walk you through the entire process step-by-step, from enabling SSH on your device to connecting via a …


Updated August 8, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to securely access and control your Raspberry Pi remotely using SSH. This tutorial will walk you through the entire process step-by-step, from enabling SSH on your device to connecting via a command line interface or graphical tool like PuTTY.

SSH (Secure Shell) is a powerful tool that allows users to remotely access and control their Raspberry Pi devices over the internet. This can be particularly useful when you need to work on your Raspberry Pi while it’s not connected to a monitor or keyboard, or if you simply prefer to manage your device from a distance.

Enabling SSH on your Raspberry Pi

To enable SSH on your Raspberry Pi, follow these steps:

  1. Open the terminal on your Raspberry Pi by navigating to Menu > Accessories > Terminal (on Raspbian) or search for “Terminal” in the activities menu (on Ubuntu Mate).
  2. Type sudo raspi-config and hit Enter.
  3. Navigate to the “Interfacing Options” menu using the arrow keys, press Enter to select it, then navigate to SSH and press Enter again.
  4. Choose “Yes” when prompted to enable or disable SSH. This will activate the SSH server on your Raspberry Pi.
  5. Select “Finish” to save the changes and exit the configuration utility.

Connecting via Command Line Interface (CLI) using PuTTY

PuTTY is a popular SSH client for Windows that allows you to connect to your Raspberry Pi remotely. Here’s how to do it:

  1. Download and install PuTTY on your computer if you haven’t already.
  2. Open PuTTY and enter the IP address or hostname of your Raspberry Pi in the “Host Name (or IP Address)” field.
  3. Under “Connection Type,” select “SSH.”
  4. Click “Open” to initiate the connection.
  5. If this is your first time connecting, a security alert will pop up. Click “Yes” to proceed.
  6. Enter the username and password for your Raspberry Pi (default is “pi” with password “raspberry”).
  7. You are now connected to your Raspberry Pi via SSH!

Connecting via Command Line Interface (CLI) using macOS or Linux Terminal

If you’re using a macOS or Linux system, you can connect to your Raspberry Pi remotely using the built-in terminal application. Follow these steps:

  1. Open the terminal on your computer and type ssh pi@<your_raspberrypi_ip>, replacing <your_raspberrypi_ip> with the IP address or hostname of your Raspberry Pi.
  2. Press Enter to initiate the connection.
  3. When prompted, enter the password for your Raspberry Pi (default is “raspberry”).
  4. You are now connected to your Raspberry Pi via SSH!

Securing Your Connection with SSH Keys

Using an SSH key instead of a password provides an additional layer of security when connecting to your Raspberry Pi remotely. Follow these steps to set up SSH keys:

  1. On your computer, generate a new SSH key pair by running ssh-keygen -t rsa in the terminal (Linux/macOS) or PuTTYgen (Windows).
  2. Copy the contents of the public key file (id_rsa.pub for Linux/macOS, id_rsa.ppk for Windows) to your clipboard.
  3. Connect to your Raspberry Pi via SSH as described above.
  4. Create a new directory for your authorized keys by running mkdir ~/.ssh and touch ~/.ssh/authorized_keys.
  5. Open the authorized_keys file with a text editor (e.g., nano ~/.ssh/authorized_keys) and paste the contents of your public key into it. Save and exit the file.
  6. Set the correct permissions for the .ssh directory by running chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys.
  7. Disable password authentication in the SSH config file by opening /etc/ssh/sshd_config with a text editor (e.g., sudo nano /etc/ssh/sshd_config) and setting PasswordAuthentication no. Save and exit the file.
  8. Restart the SSH service by running sudo systemctl restart ssh.
  9. You can now connect to your Raspberry Pi using your SSH key instead of a password.

Remember, securing your Raspberry Pi is crucial when connecting remotely. Be sure to update your software regularly and keep your passwords strong. Happy hacking!