Three ways to change your wifi pass­word and SSID on a head­less Rasp­berry Pi local­ly and remote­ly

-

Chang­ing a WiFi net­work on a Rasp­berry Pi is a triv­ial thing.

But with a dig­i­tal pic­ture frame that has no key­board or mouse attached, and a mon­i­tor which dis­plays only pho­tos by default, it can be rather tricky to change the WiFi pass­word or sta­tion name.

I will show you three sim­ple solu­tions to this prob­lem.

You are about to change your router pass­word, but you haven't done it yet

This is the most com­fort­able sit­u­a­tion because you still have access to your Rasp­berry Pi pic­ture frame.

So you first change the pass­word on your Pi, and then you make the changes in your router.

When you first set up your Rasp­berry Pi based on the instruc­tions in my arti­cle, you cre­at­ed a new file called

wpa_supplicant.conf

in the /Volumes/boot direc­to­ry.

But where is wpa_supplicant.conf now?

After sys­tem set­up, wpa_supplicant.conf is moved to anoth­er direc­to­ry.

You can now access it by ssh'ing into your Pi and typ­ing

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Just add anoth­er net­work below the last line in the script or change the cre­den­tials of your pri­ma­ry net­work.

network={
ssid="your-second-ssid"
psk="your-second-password"
key_mgmt=WPA-PSK
}

You can add sev­er­al SSID and pass­word com­bi­na­tions here.

You may also want to add a fall-back SSID/Password which can help you to access your Pi in a dif­fer­ent net­work.

In that case, you can make a tem­po­rary change in your WiFi router, update the infor­ma­tion of your Pi to your new set­tings and change your router pass­word back again.

The pass­word on your WiFi router has already changed, and you can­not tem­porar­i­ly change it back

This sit­u­a­tion requires phys­i­cal access to your dig­i­tal pic­ture frame.

One option is to remove the SD card, plug it into anoth­er Lin­ux com­put­er like e.g. the Rasp­berry Pi and enter in Ter­mi­nal:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Just like above, you will see this para­graph:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="yourssid"
psk="yourpassword"
key_mgmt=WPA-PSK
}

Update your WiFi login details, save & exit the edi­tor and start your Pi again.

Should you not be able to remove the SD card because of tight space behind your pic­ture frame or too much glue where you shouldn't have glued, then use an Eth­er­net cable to con­nect your Pi with your router direct­ly.

SSH in your Pi, enter in Ter­mi­nal

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and make your changes.

Should the dis­tance between your router and your dig­i­tal pic­ture frame be longer than the longest Eth­er­net cable in your house, you could alter­na­tive­ly use Pow­er­line adapters and estab­lish a con­nec­tion this way.

You need to change the pass­word at your par­ents' place in anoth­er town

Ok, so you have built this won­der­ful dig­i­tal pic­ture frame, and you have giv­en it to your par­ents for Christ­mas. And they don't live close by, so you can't just dri­ve by after work and fix it.

New WiFi pass­word? No rea­son to stop send­ing pic­tures.

The eas­i­est way is to add a sec­ond WiFi net­work in the wpa_supplicant.conf file with your par­ents' net­work infor­ma­tion - before you pack it up as a Christ­mas gift. The Rasp­berry Pi will check at boot if any of the com­bi­na­tions work.

Also, include a fall-back net­work like "frame" as SSID and a sim­ple pass­word like "123" for tem­po­rary use.

If you install a tool like Dat­a­plic­i­ty on the frame, you can access the remote Rasp­berry Pi pic­ture frame via ssh just like you would from at home.

Dat­a­plic­i­ty allows you to access your par­ents' Pi over the inter­net but obvi­ous­ly only as long as the net­work is still up.

So, if the pass­word or sta­tion ID is about to change, but you still have time to make the changes on the Pi, then you can do every­thing via Dat­a­plic­i­ty with no required on-site inter­ac­tion. Just use the com­mands above.

If this is not an option, your par­ents may be able to take the pic­ture frame to neigh­bor­hood friends who can tem­porar­i­ly change their WiFi to the fall-back net­work defined by you.

You can then estab­lish a con­nec­tion via Dat­a­plic­i­ty and enter the new pass­word.

And final­ly, there is always the option of a tem­po­rary eth­er­net cable con­nec­tion to your par­ents' or friends' router. You can then again use Dat­a­plic­i­ty for access.

Con­clu­sion

If you pre­pare your sys­tem upfront with a fall-back net­work and install Dat­a­plic­i­ty or a sim­i­lar tool, chang­ing the WiFi pass­word on a head­less Rasp­berry Pi sys­tem, local­ly or remote­ly, is a piece of cake.

As with many things, a lit­tle upfront plan­ning can save a lot of time!