Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.