File Permissions

Because of OS X’s Unix heritage, it has a multi-user permission model on the file system.

Users and groups

Every user on the system has an integer user ID. Each user belongs to one or more named groups, and each group has an ID. For instance:

$​ ​l​s​ ​-​l​ ​c​h​a​p​t​e​r​.​t​x​t​
-​r​w​-​r​-​-​r​-​-​ ​ ​1​ ​m​a​r​k​d​ ​ ​s​t​a​f​f​ ​ ​4​8​8​2​7​ ​A​u​g​ ​1​1​ ​1​4​:​1​4​ ​c​h​a​p​t​e​r​.​t​x​t​

The user is markd, the group is staff.

$​ ​l​s​ ​-​l​ ​/​b​i​n​/​l​s​
-​r​-​x​r​-​x​r​-​x​ ​ ​1​ ​r​o​o​t​ ​ ​w​h​e​e​l​ ​ ​8​0​6​8​8​ ​F​e​b​ ​1​1​ ​ ​2​0​1​0​ ​/​b​i​n​/​l​s​*​

ls is owned by the user root, the group wheel.

You can see what users and groups are configured on your machine with the Directory Services tools dscl and ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.