Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have CentOS and cPanel installed. I want to lock certain files (e.g. .ftpquota) from being deleted through FTP. I tried to change the ownership to root:root or root:lock but it didn't work; neither did changing the mode to 0.

How can I lock the .ftpquota file?

share|improve this question

If you don't need to modify the file then the chattr +i will lock the file from deletion. This will mark the file immutable.

Otherwise file deletion is controlled by the directory containing the file. Anyone with write access to the directory can delete most of the files it contains. Files with the sticky bit set can only be deleted by the owner. Files with the immutable attribute can not be deleted until the attribute is removed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.