0

I just noticed:

~$ touch ~/home.txt
~$ touch /tmp/tmp.txt
~$ ls -l ~/home.txt
-rw-r--r-- 1 jdough staff 0 Dec 2 15:09 /Users/jdough/home.txt
~$ ls -l /tmp/tmp.txt
-rw-r--r-- 1 jdough wheel 0 Dec 2 15:09 /tmp/tmp.txt

Is it unusual that OS X uses the file system to decide the group ownership? I'd expected all files created by a user to have staff as the group.

I've been tarring cds in /tmp and then putting them in cloud storage. Isn't that a classic use case for /tmp? As users, are we supposed to stop using /tmp? I don't want my group ownership messed with and tmp is now wired to unexpectedly change the group.

Of course, just using $HOME/tmp is fine. But, I'll be sad to stop using /tmp.

2
  • The group is set on creation so the important code is how did you create the files (But as the answer nots you should use $TMPDIR /tmp is shred between users and so can get clashes in permissions
    – mmmmmm
    Dec 3, 2015 at 14:08
  • This isn't unusual. Files inherit the group class from the directory in which they are created in.
    – fd0
    Dec 3, 2015 at 19:08

1 Answer 1

3

I had the same experience when using /tmp but using $TMPDIR worked as expected:

$ touch "${TMPDIR}/tmp.txt"
$ ls -l "${TMPDIR}/tmp.txt"

-rw-r--r-- 1 luomat staff 0 Dec  3 08:46    /var/folders/8k/0bqq33mn439938qxp7j7c1fc0000gn/T//tmp.txt

You must log in to answer this question.

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