How to Control Your Raspberry Pi from Windows Using SSH – Make Tech Easier | Hot Mobile Press

Maybe you’re tired of constantly jamming a cable into that HDMI port. Or maybe you’ve already broken the port. Either way, you can use the Raspberry Pi without a monitor thanks to SSH. This is called “Headless Computer” and is a lifesaver that makes many 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 website from anywhere in the world is probably a headless computer of a data facility.

Mini PC Raspberry Pi

Headless computers can be controlled in a variety of ways. Some listen to a website for orders. Others allow you to connect to them remotely and control them using commands on a console. This time we’re going to do the latter.

Turn your Raspberry Pi into a headless computer

We will split this into three parts. The first is to download PuTTY for Windows. Then the second would be for preparing the Raspberry Pi for SSH. The last part concerns the login to the Raspberry Pi via Windows via SSH.

Download PuTTY for Windows

  1. First, download the x86 version of PuTTY. If you are unsure about the architecture of your Windows PC, you should download the 32-bit version as it can run on both 32- and 64-bit systems. Only download the 64-bit version if you are sure you are using a 64-bit system.
Putty download page
The PuTTY download page is hosted on a different domain than the home page.
  1. Run the installer and complete the installation wizard.
Putty installation wizard
  1. With the wizard complete, 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 your Raspberry Pi has already been set up with Raspberry Pi OS.

  1. Turn on your Raspberry Pi (with a monitor of course) and then click on the Raspberry Pi icon -> Settings -> Raspberry Pi Configuration.
Raspberry Pi Rpi configuration
  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. Then check if your Raspberry Pi is connected to your wireless router. If not, click the network icon -> your Wi-Fi network name.
Raspberry Pi Wifi Networks
  1. If you click on the name of your Wi-Fi network, a new window will open. This will ask you for your WiFi password. Skip this step if you are already connected to your WiFi network.
Raspberry Pi Wifi Password
  1. Next, open the terminal and type ifconfig. You’ll find a list of information about your Raspberry Pi’s network connections. Look for something that says “wlan0” and then copy the IP address next to “inet”. You need this for the next step.
IP address of the Ifconfig terminal
Make a note of the IP address next to the word “inet”.

Login via SSH

  1. Now back to Windows. Open the PuTTY app and enter the IP address in the “Hostname (or IP address)” field. Keep the port as 22. Also make sure the “Connection Type” is set to SSH. Then click on “Open”.
Putty input IP address
  1. After that, you should be greeted with a security warning warning you about connecting to an unknown host. Click on “Accept”.
Putty Security Warning
  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 asterisks or anything like that while typing in the password area. It’s a security feature.
  1. With that all done, you should be ready to use PuTTY to control your Raspberry Pi over SSH!
Putty SSH terminal

What can you do with your headless Raspberry Pi?

Now you know how to access the terminal on your Raspberry Pi via Windows via SSH. Next you need to know how to use it.

You must remember that the Raspberry Pi OS is based on the Debian distribution for Linux. This means you can use Linux terminal commands in the PuTTY terminal window to do basically anything.

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

Important Linux terminal commands

Given all of this, there are some commands you need to know if you’re new to doing things on the Linux terminal. Here are some of them you might want to know.

  • Turn off computer: sudo shutdown -h now
  • Restart computer: sudo reboot -h now
  • Change directories: cd <path>
  • List files and directories: dir or ls

Without a file explorer to click, you have to type in the terminal window where you want to go. Use cd Change directories and dir to show what is in the current directory.

If you dig a little deeper into the Linux virtual directory structure, you can better understand how cd is working.

  • Create new folders: mkdir <folder name>
  • Using a text editor: nano <filename>

Perhaps the simplest text editor out there, nano you can 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 if you’re just scribbling with programming ideas.

Nano Terminal window New File
The terminal window should rotate like this after entering nano your-filename.txt.
  • Deleting files and folders: rm <file or folder name>

See this article for more information on deleting files on Linux.

  • Install packages: sudo apt <install or uninstall> <package 1> <package 2>

Typically you use this command to install or uninstall one or more packages. For example, you could install the Python 3 package to give input control to the Raspberry Pi’s GPIO pins 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 that cd Command to change to a directory that does not exist, the terminal returns “No such file or directory” and does nothing else.

What should I do if I make a typo when entering my password?

If you make a mistake, you can use the backspace key to delete the last character you typed. Alternatively, you could also use <- and -> along with home and End to navigate between characters. Or you could use ctrl + A to select all, then press Extinguish or backspace to remove everything. This is useful when you don't know which character was wrong.

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

When shutting down, PuTTY only knows that it suddenly lost connection to the Raspberry Pi. It doesn't know if it shut itself down or disconnected from the network. Therefore, a "Fatal error" warning message should appear after entering it sudo shutdown -h now on the end device. The same should work for all other variants as well, like the reboot commands.

Photo credit: Close-up of Raspberry Pi Pico by 123RF

Is this article useful?

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Leave a Comment