What Is Sticky Bit?
Sticky bit, sticky bit, a sticky bit. We all know the story of a little kid who didn't want to share his dessert with his brother (and sister), so he hid it under the couch. A sticky bit is file permission that allows only the owner to modify, rename, or delete it when set on a directory or file. Without the sticky bit set, any user can do those things regardless of who owns the file. The sticky bit is used in Unix-like operating systems to protect important files from accidentally overwritten or deleted (aka "trashed"). It would be easy to click on that file, and press deletes or move it elsewhere. It's more complex. The sticky bit will prevent you from doing this, even if you're the file owner! So how does the sticky bit work? When a file has the sticky bit set, it can't be deleted by anyone but its owner (who also has to be logged in as root). It also means that only one process can write to the file at any given time, and only one can access it once that process is done writing. The sticky bit is set with chmod +t, which is short for change mode. You can see if a file has the sticky bit set by running the ls -l command at the shell prompt (or using your favorite GUI). If you have a sticky bit set on your file or directory, you'll need root access to do any of those things! So why would you want this? For example, suppose you have sensitive data on your computer and don't want anyone else messing with it even accidentally. Setting the sticky bit on that directory is an excellent way to keep people out. It also means that if someone does get into your folder somehow and tries to mess with something inside there, they'll probably get caught because they won't have root access! If you're looking for a way to lock down your folders, so nobody can touch them without permission, setting the sticky bit might be up.
Related Terms by Data Management
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.