Apple Blog

A curiosity of Mac OS X: the “sticky bit”

System permissions, ACLs, protected files, folders… the number of special features in Mac OS X folders is such that it often costs quite a bit to implement all of them.

The sticky bit is a rather special feature of Apple’s system that is actually one of those little “legacies” of the UNIX system. Thanks to this feature, some system folders have a rather peculiar behavior.

A curiosity of Mac OS X: the “sticky bit”
A curiosity of Mac OS X: the “sticky bit”

Specifically in the system we have a folder that, by default, makes use of this technology. This folder is the Shared folder, which has a peculiar property: any user can leave content inside this folder, but only the users who have copied those files are able to remove them.

Sticky bit, operation and how to know which folders use it

From Wikipedia we can rescue a little history of this peculiarity of UNIX systems:

By default, in the current version of Mac OS X, only one folder in the entire system includes this enabled feature. This folder is called “Shared” and can be found inside the Users folder of the system.

This folder has the peculiarity that any of the users of the operating system have permissions to write and see its content, that is, they can do whatever they want with it, but only and exclusively the users who have copied a file to this folder can delete it.

That is to say, only the user who copies a file into it can delete it from the folder, although he will be able to see and copy the rest of the available files, although under no circumstances can he delete them.

How to assign this property to a file

Creating more folders like these in the operating system is quite simple, although we have to resort to the Terminal to be able to perform the task.

  • The first step we have to follow is to create a folder, to this folder we will apply this property.
  • Once created we will have to open the terminal and locate it using the system’s navigation.
  • When we have located the folder we must execute this command:

chmod -R +t “folder name”

  • Once the new command is applied we can check if we have applied the permissions correctly using the command “ls -l” which will show us in addition to the permissions a “t” at the end of them to indicate that we are talking about a folder with sticky bit activated.

Similar Posts