I have an account on macOS 10.13.2 (High Sierra) where groups returns this:

staff everyone localaccounts com.apple.sharepoint.group.2 
_lpoperator com.apple.sharepoint.group.1

Yet when I touch a new file I see wheel, which is not in the list, as GID:

$ touch /var/tmp/hello
$ ls -l /var/tmp/hello
-rw-r--r--  1 account  wheel  0 Dec 24 18:36 /var/tmp/hello

What is going in here? (If this were, say, Debian I would have expected the new file to be owned by account:account instead of account:wheel).


/var/tmp has the sticky bit set:

pse@Mithos:~$ ll -d /var/tmp
drwxrwxrwt  5 root  wheel  170 Dec 24 16:17 /var/tmp/

so any files created in there inherit the group of the directory.

From man sticky:

A directory whose `sticky bit' is set becomes an append-only directory, or, more accurately, a directory in which the deletion of files is restricted. A file in a sticky directory may only be removed or renamed by a user if the user has write permission for the directory and the user is the owner of the file, the owner of the directory, or the super-user. This feature is usefully applied to directories such as /tmp which must be publicly writable but should deny users the license to arbitrarily delete or rename each others' files.

Any user may create a sticky directory. See chmod(1) for details about modifying file modes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .