How do I use the linux flock command to prevent another root process from deleting a file?

前端 未结 3 578
情深已故
情深已故 2020-12-19 01:46

I would like to prevent one of my root processes from deleting a certain file. So I came across the flock command, it seems to fit my need, but I didn\'t get its syntax.

3条回答
  •  被撕碎了的回忆
    2020-12-19 02:11

    flock is not the right tool for this job. If you have a programme that is deleting files, you should not run that programme as root. You should run it as a different user. Unix has very good support for file permissions, but root is a god account. Root can do everything, and there are no permissions for root.

提交回复
热议问题