Not untill yesterday when my student and I attempted to remotely access the Raspberry Pi 4B model to no avail did I realize the need to simplify steps to run SSH smoothly. This post is dedicated to Travis, a young inspiring Linux /Raspberry Pi enthusiast. It can apply to all Raspberry Pi SBCs versions.
In this post, I will cover:
Access your Pi remotely from Windows
There are tons of related tips and tricks on the web but most of them require you to download some software which are not necessary since you can achieve this directly from Windows Power Shell. You only need two command lines.
Step 1: press windows + S to search for Power Shell, then hit Enter
Step 2: type the following and mark down the IP adderss of your Pi. In this case, it is 10.10.0.142
ping raspberrypi
Step3: enter your Pi IP address from the last step.
ssh pi@"your pi address"
Congratulations! You have succeesfully logged into your Pi through SSH.
How to change hostname
Changing hostname is often the first thing to do to claim your Pi. A 6 year-old boy can do that from a desktop environment so we won't spend time covering that. Instead, let's try the old-fashioned way, using only the Linux commands like those 70-80s sci-fi movies.
*warning: changing your hostname means that you can no longer use ping raspberrypi to retrive your Pi IP address. You need to replace it with your new hostname to proceed further.
Step 1: verify your existing hostname. In terminal, type the following:
hostname
Step 2: edit the hosts file with the following:
sudo nano /etc/hosts
Then replace all occurences of your original hostname into a new one.
Step3: Edit the hostname file by typing:
sudo nano /etc/hostname
From there, change the hostname as well. With that done, reboot your Pi by:
sudo reboot now
When you log back into your pi, verify your hostname again by typing hostname. You should have a new hostname now.
Set up multiple wifi network connections
A common method to set up Wifi connection is to create a wpa_supplicant.conf file on the boot folder through a SD card from another computer. This method is completely fine if you only work on your projects at home.
But there comes many occasions where you have to move your Pi to a different place, such as home, school, Maker Faire, park, etc. It makes no sense to set up Wifi using the method above everytime. This is assuming that your Pi is running headless.
Many tricks and tips online can solve this issue but they are overly-complicated and not user-friendly. Most of the time, and worst of all, they're obsolete! They don't offer reasons why they are doing this and that.
Don't fret. Here's a remarkably easy way to get round this. Using the method below, your Pi will be automatically connected to a known Wifi network when you're moving places, just like your phone.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
From there, add as many networks to your heart content. Make sure ssid and psk are correct.
Press Ctrl X to save and Y to exit.
Reboot your computer.
Done! That's how easy it is!
Comments