Skip to main content
IBM 
ShopSupportDownloads
IBM HomeProductsConsultingIndustriesNewsAbout IBM
IBM : developerWorks : Linux : Education - Tutorials
LPI certification 101 exam prep, Part 3
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. The Linux permissions model
  


Directories and deletion page 22 of 23


By default, Linux directories behave in a way that may not be ideal in all situations. Normally, anyone can rename or delete a file inside a directory, as long as they have write access to that directory. For directories used by individual users, this behavior is usually just fine.

However, for directories that are used by many users, especially /tmp and /var/tmp, this behavior can be bad news. Since anyone can write to these directories, anyone can delete or rename anyone else's files -- even if they don't own them! Obviously, it's hard to use /tmp for anything meaningful when any other user can type "rm -rf /tmp/*" at any time and destroy everyone's files.

Thankfully, Linux has something called the "sticky bit". When /tmp has the sticky bit set (with a chmod +t), the only people who are able to delete or rename files in /tmp are the directory's owner (typically root) the file's owner, or root. Virtually all Linux distributions enable /tmp's sticky bit by default, but you may find that the sticky bit comes in handy in other situations.


Main menuSection menuFeedbackPreviousNext
PrivacyLegalContact