If you don’t want a file edited or deleted, you can set the immutable attribute to ON. If activated, not even root or the owner of the file can delete it. Users with write access can still read it, but they obviously will not be able to modify it. To unset it, just use the -i option.

<pre lang="bash"># Set immutable attribute
sudo chattr +i text.txt

# Unset immutable attribute
sudo chattr -i text.txt