Delete Wifi Credentials from Raspbian cloned image
I have a custom Raspbian image (based on Raspbian lite + some additional software installs) and I would like to clone this image and distribute it as part of an opensource project. How can I delete the WiFi credentials or other sensitive information from the cloned image. I know that I can always delete the credentials before cloning but I would like to automate the process so would rather not modify the image on the sd card.
- pi-anazazi
- Posts: 937
- Joined: Fri Feb 13, 2015 9:22 pm
- Location: EU
Re: Delete Wifi Credentials from Raspbian cloned image
Code: Select all
sudo nano /etc/hostapd/hostapd.conf

Kind regards
anazazi
anazazi
Re: Delete Wifi Credentials from Raspbian cloned image
I don't think I can do that.
The cloned file is in .img format so how can I access its contents?
Re: Delete Wifi Credentials from Raspbian cloned image
Search for loop mounting image files. Also lookup losetup and kpartx.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574
- pi-anazazi
- Posts: 937
- Joined: Fri Feb 13, 2015 9:22 pm
- Location: EU
Re: Delete Wifi Credentials from Raspbian cloned image
You can mount the .img into a directory and manipulate the file system as you want. It's Linux, not M$ 

Kind regards
anazazi
anazazi
-
- Posts: 91
- Joined: Wed Jun 10, 2020 7:04 am
Re: Delete Wifi Credentials from Raspbian cloned image
There's a stick at the top of this section of the forum, viewtopic.php?f=63&t=231762glamis wrote: ↑Thu Aug 13, 2020 6:14 amI have a custom Raspbian image (based on Raspbian lite + some additional software installs) and I would like to clone this image and distribute it as part of an opensource project. How can I delete the WiFi credentials or other sensitive information from the cloned image. I know that I can always delete the credentials before cloning but I would like to automate the process so would rather not modify the image on the sd card.
It'll explain how to mount an image for editing.
| Raspberry Pi 4-8GB | 2.0GHz | over_voltage@5 |
| Raspberry Pi OS 32bit |
| https://github.com/bassamanator/raspberrypi-scripts |
| Raspberry Pi OS 32bit |
| https://github.com/bassamanator/raspberrypi-scripts |