glamis
Posts: 2
Joined: Thu Aug 13, 2020 6:11 am

Delete Wifi Credentials from Raspbian cloned image

Thu Aug 13, 2020 6:14 am

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.

User avatar
pi-anazazi
Posts: 938
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: Delete Wifi Credentials from Raspbian cloned image

Thu Aug 13, 2020 7:53 am

Code: Select all

sudo nano /etc/hostapd/hostapd.conf
? :-)
Kind regards

anazazi

glamis
Posts: 2
Joined: Thu Aug 13, 2020 6:11 am

Re: Delete Wifi Credentials from Raspbian cloned image

Thu Aug 13, 2020 10:12 am

pi-anazazi wrote:
Thu Aug 13, 2020 7:53 am

Code: Select all

sudo nano /etc/hostapd/hostapd.conf
? :-)
I don't think I can do that.
The cloned file is in .img format so how can I access its contents?

User avatar
procount
Posts: 2454
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Delete Wifi Credentials from Raspbian cloned image

Thu Aug 13, 2020 12:11 pm

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

User avatar
pi-anazazi
Posts: 938
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: Delete Wifi Credentials from Raspbian cloned image

Sat Aug 15, 2020 7:56 am

You can mount the .img into a directory and manipulate the file system as you want. It's Linux, not M$ :-D
Kind regards

anazazi

bassamanator
Posts: 91
Joined: Wed Jun 10, 2020 7:04 am

Re: Delete Wifi Credentials from Raspbian cloned image

Sat Aug 15, 2020 9:02 am

glamis wrote:
Thu Aug 13, 2020 6:14 am
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.
There's a stick at the top of this section of the forum, viewtopic.php?f=63&t=231762

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 |

Return to “General discussion”