You ask the question in terms of absolutes, and there is no absolute way to do this. If your program can read and modify your file, then for another program or person there should be a way to do this too.
File permissions may help, but can you trust the root or admin user?
Even if permissions are right, can you trust other programs that run as your username?
Encrypting a file will make it difficult to read the file, but will not damage it. And a βcertainβ person with access to your program will be able to find the decryption key (otherwise you would not be able to read it yourself).
In the end, you should ask yourself: "What are some reasonable steps I can take so that itβs not worth trying to access / read / modify the file?"
source share