How to control your Raspberry Pi through Windows via SSH

Maybe you’re tired of jamming a cable to that HDMI port all the time. Or maybe you have already broken the port. In any case, you can use the Raspberry Pi even without a monitor thanks to SSH. It’s called a “headless computer,” and it’s a lifesaver that makes a lot of things easier.

What is a headless computer?

A headless computer is a computer without a monitor. This computer can be anything – it doesn’t even have to be a Raspberry Pi. To give an example, the web server that allows you to access this web page from any part of the world is probably a headless computer from a data facility.

Raspberry Pi Mini PC

Headless computers can be controlled by different means. Some listen to a web page to receive commands. Others allow you to connect to them remotely and control them via commands on a console. This time we will do the latter.

Turn your Raspberry Pi into a headless computer

We will divide this into three parts. The first is to download PuTTY for Windows. Then the second would be to prepare the Raspberry Pi for SSH. The last part will be used to connect to the Raspberry Pi via Windows via SSH.

Download PuTTY for Windows

  1. First, download the x86 version of PuTTY. If you are unsure of the architecture of your Windows PC, the safest bet is to download the 32-bit version as it can work on both 32 and 64-bit systems. Download the 64-bit version only if you are sure you are using a 64-bit system.
Putty Download Page
The PuTTY download page is hosted on a different domain from the homepage.
  1. Run the installer and complete the installation wizard.
Putty Installation Wizard
  1. After completing the wizard, let’s put that aside and configure the Raspberry Pi to allow SSH.
Putty application screen
PuTTY configuration window.

Prepare your Raspberry Pi

This assumes that your Raspberry Pi has already been configured with Raspberry Pi OS.

  1. Power on your Raspberry Pi (with a monitor, of course), then click the Raspberry Pi icon -> Preferences -> Raspberry Pi Configuration.
Raspberry Pi Rpi Setup
  1. You should see a new window open. Go to the Interfaces tab then click “Enable” in the area that says “SSH”.
Rpi configuration interface and Ssh settings
  1. Next, check if your Raspberry Pi is connected to your Wi-Fi router. If not, click the Network icon -> your Wi-Fi network name.
Raspberry Pi Wi-Fi Networks
  1. If you click on the name of your Wi-Fi network, a new window will appear. This will ask you for your Wi-Fi password. Skip this step if you are already connected to your Wi-Fi network.
Raspberry Pi wifi password
  1. Then open the terminal and type ifconfig. You’ll find a list of things about your Raspberry Pi’s network connections. Look for something that says “wlan0” then copy the IP address next to “inet”. You will need it for the next step.
IP address of the Ifconfig terminal
Note the IP address next to the word “inet”.

Login via SSH

  1. Now back to Windows. Open the PuTTY app then type the IP address in the box that says “Hostname (or IP address)”. Keep the port at 22. Also make sure the “Connection Type” is set to SSH. Click “Open” after that.
Putty Ingress IP Address
  1. After that, you should be greeted with a security alert, warning you about connecting to an unknown host. Click “Accept”.
Putty Safety Alert
  1. You will then see a login prompt. By default, your Raspberry Pi should have “pi” as the username. The default password is “raspberry”.
Putty login prompt
You won’t see any asterisks or anything when typing in the password box. It is a security function.
  1. With all that done, you should be ready to use PuTTY to control your Raspberry Pi via SSH!
SSH putty terminal

What Can You Do With Your Headless Raspberry Pi

You now know how to access your Raspberry Pi’s terminal through Windows via SSH. Then you need to know how to do things with it.

The thing you need to remember is that the Raspberry Pi operating system is based on the Debian distribution for Linux. This means that you can use Linux terminal commands on the PuTTY terminal window to do almost anything.

However, this only works if you have the Raspberry Pi operating system on your Raspberry Pi. It won’t work if you have something else on your system, such as Windows 11.

Important Linux Terminal Commands

Considering all of this, there are some commands you should know if you’re not yet used to doing things in the Linux terminal. Here are a few you might want to know.

  • Shutting down the computer: sudo shutdown -h now
  • Restart the computer: sudo reboot -h now
  • Change directory: cd
  • List files and directories: dir Where ls

With no file explorer to click on, you just have to type where you want to go in the terminal window. Use cd change directory and dir to show what is in the current directory.

Reading a little deeper into the Linux virtual directory structure might help you better understand how cd works.

  • Creating new folders: mkdir
  • Using a text editor: nano

Perhaps the simplest text editor there is, nano allows you to write text files and programming scripts on the go. Sure, it’s not an IDE that can even compile code for you, but it’s good enough when you’re just scribbling with coding ideas.

Nano Terminal New File Window
Terminal window should rotate like this after entering nano your-filename.txt.
  • Deleting files and folders: rm

See this article for more details on deleting files in Linux.

  • Installing the packages: sudo apt

Typically, you use this command to install or uninstall one or more packages. For example, you can install the Python 3 package to control the Raspberry Pi’s GPIO pins by typing sudo apt-get install python3-rpi.gpio.

You might want to learn more about apt if you want to do more software related things on the Raspberry Pi.

Frequently Asked Questions

What happens if I cd to a directory that doesn’t exist?

If you try to use the cd command to access a nonexistent directory, the terminal will return “No such file or directory” and do nothing else.

What should I do when I make a typo when entering the password?

If you make a typo, you can use backspace to delete the last character you typed. Alternatively, you can also use and -> in the same way House and End to navigate between characters. Or you can use CTRL + A to select all then press Wipe off Where Going back to delete everything. This one is useful if you don't know which character was wrong.

Why is there a warning message when I turn off my Raspberry Pi?

When you turn it off, PuTTY only knows that it suddenly lost its connection to the Raspberry Pi. It doesn't know if it turned off or disconnected from the network. Therefore, a "Fatal Error" warning message should appear after entering sudo shutdown -h now on the terminal. The same should also work for all its other variants, like restart commands.

Image Credit: raspberry pi pico close-up by 123RF

Was this article helpful?

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

About Jon Moses

Check Also

Check department, course name and other details here

NSIC Recruitment 2022: Check Department, Course Name and Other Details Here 2022 NSIC recruitment: National …