I tried using chmod 000 <file>, chown -R root <file> and chgrp sys <file> . But it seems it can still be removed without root permission. When I executed rm <file> , the command line just shown a prompt of override --------- root/staff for <file>? . It can delete the file without asking for root.


1 Answer 1


So I found what I should do from the link provided from anki .

All I need to do is chflags uchg <file>

The details of this command are in this link: http://hints.macworld.com/article.php?story=20031017061722471

  • 2
    Pointing out that whether or not you can delete a file has to do with the permissions on the directory containing it, not on the file itself. The containing directory is the one being written to. I would not be surprised if a user could remove the immutable flag, then delete the file. Aug 31, 2021 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .