2

I've developed a headless system that uses RPi OS Lite. I need to move it to another location that has different WiFi logon credentials. It seems that I need to either create a wpa-supplicant.conf file in /boot and/or edit the wpa-supplicant.conf file in /etc/wpa-supplicant with the new logon credentials. What's the solution?

1
  • It seems that I need to either .... - correct, either of those methods works Dec 11, 2022 at 21:24

2 Answers 2

1

I've never used the "add wpa.supplicant to /boot" method, and I am not sure if that works beyond the first time, and/or if there is a non-default /etc/wpa_supplicant.conf already present.

In any case, what that does is copy the file from the boot partition into /etc in the root fs -- that's the one that wpa_supplicant actually uses (or at least the normative/conventional one, this is dependent on its command line arguments).

So your best bet is to:

  • Make sure there is not a wpa_supplicant in /boot.
  • Add the correct conf to /etc/. You don't have to edit the one that's there, BTW, you can just replace it, as long as you are sure it works; a common practice when replacing/customizing conf files is to move the default one to a file with a special suffix like .default or .dist (for "distribution"). This should be owned root with permissions set 600.
2
  • goldielocks, thanks for the response. I looked at the file in /etc/ and noticed my password was replaced with a long key. Will that make a difference? The not having the file in /boot is what I was looking for. I don't want to go through the rebuilding the system again. It resides in a project box and the SD card is difficult to get to. Dec 11, 2022 at 16:39
  • Presuming that conf still works to connect, it sounds like what might be going on is this: unix.stackexchange.com/q/278946/25985
    – goldilocks
    Dec 11, 2022 at 17:16
0

Once ANY Pi running Raspberry Pi OS has been correctly setup initially you can simply change wpa_supplicant by putting in the boot partition (provided it has the correct country code). This will be removed on next boot.

This is actually preferable to attempting to copy a file to /etc/wpa_supplicant as it sets the correct permissions.
I do this routinely when I modify my system which has a dozen networks for different locations.

NOTE does not work for Ubuntu and AFAIK if using Network Manager.

NOTE the boot partition is only mounted in /boot AFTER boot.

The password can be in plain text or a 256-bit PSK formed from the SSID and passphrase by the wpa_passphrase utility. This is encoded, not strictly encryption although it is practically impossible to reconstruct the plain text password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.