By way of explanation...
The Raspberry Pi normally uses a MicroSD card formatted with two partitions, called boot
, and root
. The root
filesystem (if you're using Raspbian, the most common case) is an ext4
filesystem that contains the entire normal Unix/Linux filesystem, mounted as "/" after startup, while boot
is a DOS-style FAT
filesystem, that is used only during booting, and ends up mounted as "/boot" after the system is running. When you attach the MicroSD card from a Raspberry Pi to a typical "desktop" computer (Mac or Windows), you'll get read/write access to the boot
partition, while the root
partition is normally invisible - it can only be mounted by installing extra drivers and fiddling around.
Also, the SSIDs and passphrases for WiFi networks are normally kept on the Raspberry Pi in the file /etc/wpa_supplicant/wpa_supplicant.conf
My apologies if I'm overexplaining and you already know these bits; they make this next part understandable...
Quoting from the article on this site titled, "The latest update to Raspbian
• If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.
So, if you do the initial configuration of a Raspbery Pi, you should be able to then copy the file /etc/wpa_supplicant/wpa_supplicant.conf
, where it will be accessible when the MicroSD card is mounted in a PC or Mac, where you'll be able to change the contents as needed.
I'm not actually certain whether the file gets copied
(yes, I know it says "moved"), as I've not had a reason to try it myself. But if it does get removed from /boot in the process, you can simply keep a copy there with a different name, say, wpa_supplicant.base
, and then edit that as needed and make a copy named wpa_supplicant.conf
when you're done.
The file has the network's SSID and passphrase in a section like this:
Code: Select all
psk="Your Network's Passphrase"
You can add multiple entries like this, so you should be able to make the Pi connect to any of several WiFi networks, as needed.