An app, due to an unfixed glitch, keeps overwriting an important file
How to lock that file so that it cannot be overwritten ?
Have root. Don't have xposed
An app, due to an unfixed glitch, keeps overwriting an important file
How to lock that file so that it cannot be overwritten ?
Have root. Don't have xposed
You can remove write permission on your file. You would need toybox (inbuilt in Android since v5.0) or busybox. Assuming you have toybox already, use these commands in a terminal emulator:
su
cd /data/media/0/DIR # replace DIR with wherever your file is. E.g. if the file is in /sdcard/Download, then DIR should be Download, so that the whole command looks like /data/media/0/Download
toybox chown 444 FILE_NAME # this would set read-only permission for every user in the system for that file. Change 444 to 666 to revert changes.
chattr +i FILE_NAME # alternative to above command. This prevents writing as well as deletion of the file. Change +i to -i to revert changes.
If you're wondering why the commands are performed on file under /data/media/0
, read the answer here from Irfan Latif.
Q & A