3

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?

1 Answer 1

10

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.