I am looking at building a script, which eventually needs to install some application - copying folders/files to certain places in Mac & Linux. User should not be able to delete those folders/files or the script i pass to user. Is there any way to achive this?
For mac - sudo chflags schg /path/to/file
- can be set.
For Linux - i can set sticky bit via chmod +s /path/to/file
.
Problem is, if the user knows administrator password ( root password i meant), then they can change the permissions and then delete using rm -rf
.
Question is how do i catch them? How do i make sure, if in case user as root runs rm -rf
, its catched, and my files/folders does not get deleted.
Any pointers to this are greatly helpful.
Thanks
EDITED: Due to a clarifying note by the OP, the purpose here is to control network users who somehow got the root password, rather than subvert the will of the lawful owner of the machine.