How do I access the /boot partition on the SD card so that I can edit the wpa_supplicant.conf file?

  • Just put the card in ANY computer and "edit". NOTE the existing file is NOT in /boot, and any file will be copied and deleted when the Pi boots.
    – Milliways
    Commented Aug 2, 2019 at 8:22

4 Answers 4


If you're meaning to access it on an operational Raspberry Pi: it's not in /boot, as other have explained.

If you're meaning to create it on an SD card on another computer: /boot is the small MS-DOS partition that shows up under Windows or Mac OS. You have to create the /boot/wpa_supplicant.conf yourself, and it will automatically be moved to the right place when you boot your Raspberry Pi.


You will need to get access to the wpa_supplicant.conf file located in:


Remove and mount the disk in another computer and modify the file..

You can:

-Obtain an HDMI cable for the Pi Zero W, a USB hub to connect mouse and keyboard. Edit through monitor. It's nice to have these 'tools' handy for this reason.

This has happened to me a few times, so I had a modification implemented from following this awesome resource:

Updated Link: https://raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/183-raspberry-pi-automatic-hotspot-and-static-hotspot-installer

Basically, when the RPi is away from any access points that it uses in wpa_supplicant.conf, it will detect AP no longer available, and automatically create it's own hotspot, so then I can connect to the RPi directly over it's WiFi hotspot. So when my home network is unavailable, I can still connect and ssh into the Pi. This creates a network, and allows other devices to connect as well to this network.

The RPi SD has 2 partitions, one is the FAT boot partition, and the other is the OS with User data etc on ext4 file system. Windows can't read this out the box, so keep that in mind if your only alternative machine to edit SD is a windows, then, a (hindsight) solution, would be to create a symlink of the wpa_supplicant.conf to the FAT side, which Windows will be able to see, assuming Windows is your only other computer to read the RPi SD. But this would need to be done when the RPi is accessible.

At this point it's probably easiest to take the SD to a linux machine, or other capable of reading and writing to that ext4 partition.


There is another means to modifying the wpa_supplicant.conf file if you can only access the /boot directory.

You can simply re-create a wpa_supplicant.conf file and save it into this /boot root directory, and upon reboot, the OS will copy this file to where the old one is.

Here is a link I found. https://www.glennklockwood.com/sysadmin-howtos/rpi-headless-boot.html


The boot partition is mounted to the directory /boot so you can just access it, for example with ls /boot.

But you will not find wpa_supplicant.conf there. It is located at /etc/wpa_supplicant/wpa_supplicant.conf.


If a wpa_supplicant.conf file is located in the /boot directory of a freshly flashed Raspberry Pi OS SD card, it will be copied into /etc/wpa_supplicant when the Pi is booted.

This wpa_supplicant.conf file can be created and placed on the SD card using the same system you used to copy the Raspberry Pi OS image to the SD card, allowing you to boot up a Raspberry Pi for the first time and have it automatically connect to your WiFi network.

This wpa_supplicant.conf should look something like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Of note, ctrl_interface= is required for command-line utilities to communicate with wpa-supplicant. Without this, you're apt to get errors like Could not connect to wpa_supplicant.

You also have to make sure that SSH is enabled on first boot to actually access your newly minted Pi over WiFi. To do this, put an empty file named ssh into the same /boot directory of the SD card. Raspberry Pi OS will detect this file on boot, enable SSH and remote login, and then delete this file.

From this point, you can use something like Ansible to configure the Raspberry Pi without having to plug in a keyboard, mouse, or monitor. Just be sure to change the default login/password, since anyone who can ssh to the Pi will be able to log in using the pi user account.

Source: https://www.glennklockwood.com/sysadmin-howtos/rpi-headless-boot.html#:~:text=conf%20file%20is%20located%20in,when%20the%20Pi%20is%20booted.

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.