I'm currently working on an embedded linux device, i'm trying to make the file system read only which is fairly easy to do, but the application requires read/write access to files in
/etc folder (mainly passwd and shadow) those cannot be moved out to the persist partition and linked back to
/etc. I came up with a "solution" not sure if it is a good thing or not and that is why I'm posting here.
Basically what I'm planning to do is make the whole file system read only (including
/etc), then add a file
/etc/rw-files which will hold paths to files that require read/write privileges for the device to work properly. on each boot I will have a script go through that list of files and folder and remount them as read/write using something like this :
mount --bind directory directory mount -o remount,rw directory directory
i tested this, it is working and device is behaving as it should but i'm still not quite sure of the quality of it.