Sorry if this question was asked already, I just could not find the answer. If I do:
touch file.txt
chomd 444 file.txt
in principle, everyone (except ROOT) can only read the file. However if I do:
rm file.txt
I still can remove the file, despite I am shown:
rm: remove write-protected regular empty file 'file.txt'? y
even if it is protected. Is there a way to really protect this file? I see that one can chattr +i file.txt
but that only works if you can sudo
; I am not an administrator (as 99% of the users out there).
Cheers.
chmod 444
and then I try to remove, the only thing preventing me from the deletion is that line asking me if I really want to delete. If I am tired, I might just typey
and enter.If I use ranger-fm, no such a comment appears and It just goes ahead with the deletion. Nowadays I mostly use ranger-fm.
From the accepted answer, the way to do this is to protect the whole directory containing the files with
– John Jan 16 '23 at 08:33chmod 555
, at least that works for me.