I tried chattr +i DIRNAME, it's great, but I cannot create files in the DIR after chattr. What else are there to prevent users from deleting a Directory?root@HOST ~] mkdir test[root@HOST ~] chattr +i test[root@HOST ~] cd test[root@HOST ~/test] touch sthtouch: cannot touch `sth': Permission denied[root@HOST ~/test] cd ..[root@HOST ~] chattr -i test[root@HOST ~] cd test[root@HOST ~/test] touch sth[root@HOST ~/test] UPDATE: only the directory deletion is important, so I still need the files to be deleted in it
How to prevent users from deleting a directory?
permissions;files
So what is wrong with a simple chown/chmod?:cd /tmpmkdir questionsudo chown root:root question[sudo] password for user: chmod 777 ./questiontouch sthrm sthcd ..rm question -rfrm: cannot remove `question': Operation not permittedOK, let me tell you what is wrong with this: every user has all access to every file in the question directory due to the 777 permissions. It is better to create a new group groupadd questionmkdir questionchown root:question ./questionchmod 770 ./questionadd the users that must have access to the files to the new group: usermod -G group userThe important trick here is that the directory has a different owner than any of the users that will try to delete it.