Remote into your Raspberry Pi using SSH and PuTTY on Windows

Learn how to connect to a Raspberry Pi running Linux remotely from a Windows computer using Secure Shell (SSH) and the PuTTY client. This guide will show you how to set up an SSH server on your Raspbe …


Updated October 2, 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 connect to a Raspberry Pi running Linux remotely from a Windows computer using Secure Shell (SSH) and the PuTTY client. This guide will show you how to set up an SSH server on your Raspberry Pi, generate SSH keys, configure PuTTY for secure access, and finally connect to your Pi.

Raspberry Pi is a popular single-board computer used for various projects in education, home automation, and digital art. One of the most common tasks for any Raspberry Pi user is remote access from another device, such as Windows PC or Mac. In this guide, we will show you how to access your Raspberry Pi from a Windows computer using SSH (Secure Shell) and PuTTY client.

Step 1: Set up an SSH server on your Raspberry Pi

First, ensure that your Raspberry Pi is running a Linux distribution that supports SSH. The latest versions of Raspbian come with SSH pre-installed, so you don’t need to do anything if you are using the latest version. If not, you can enable SSH by following these steps:

  1. Open the terminal on your Raspberry Pi and type sudo raspi-config.
  2. Navigate to Interfacing Options > SSH and select Enable SSH.
  3. Choose Finish and reboot your Pi when prompted.

Step 2: Generate SSH keys

SSH keys are a more secure way of authenticating yourself to the Raspberry Pi instead of using a password. To generate a key pair, follow these steps on your Windows computer:

  1. Open Git Bash (if you have it installed) or any other terminal emulator that supports SSH keys. If not, you can use PuTTYgen which comes with the PuTTY package.
  2. Type ssh-keygen -t rsa to generate a new RSA key pair. You will be prompted for a file path to save your private and public keys. Save them in a secure location.
  3. Open your public key file (with a .pub extension) with a text editor and copy the contents.

Step 3: Configure PuTTY for secure access

PuTTY is a free SSH client for Windows that you can use to connect to your Raspberry Pi remotely. Follow these steps to set up PuTTY:

  1. Download and install PuTTY from the official website (https://www.putty.org/).
  2. Open PuTTY and enter your Raspberry Pi’s IP address or hostname in the Host Name field.
  3. Go to Connection > SSH > Auth, select your private key file in the Private key file for authentication field.
  4. In the category “Session,” save your configuration as a profile for easy access later (e.g., Raspberry Pi).
  5. Click Open to connect to your Raspberry Pi.

If you have not copied your public key to your Raspberry Pi yet, follow these steps:

  1. Log in to your Raspberry Pi using the default pi user and password (raspberry).
  2. Create a new file called authorized_keys in the .ssh directory of the pi user by running touch ~/.ssh/authorized_keys.
  3. Open the authorized_keys file with a text editor (e.g., nano) and paste your public key into it: nano ~/.ssh/authorized_keys.
  4. Save the changes and exit the editor.
  5. Set the correct permissions for the authorized_keys file by running chmod 600 ~/.ssh/authorized_keys.

Step 4: Connect to your Raspberry Pi from Windows

  1. Open PuTTY and select the profile you saved in step 3 (e.g., Raspberry Pi).
  2. Click Open to connect to your Raspberry Pi. You will be prompted for your username, password, or private key passphrase if you set one during key generation.
  3. Once connected, you can run Linux commands on your Raspberry Pi as if you were sitting in front of it!

Remember that when using SSH, it is essential to keep your system updated and secure. Be cautious about installing new software and services, and always use strong passwords or key pairs for authentication.