Sample Header Ad - 728x90

Sticky bit on /tmp doesn't do what it's supposed to?

3 votes
2 answers
579 views
I frequently run a script that creates three files in /tmp and then moves them to the destination directory. I was puzzled by the error messages: mv: ./20170608-l.gpx: set owner/group (was: 503/0): Operation not permitted mv: ./20170608-u.gpx: set owner/group (was: 503/0): Operation not permitted mv: ./20170608.csv: set owner/group (was: 503/0): Operation not permitted The script doesn't use sudo, so the group wheel (zero) seemed odd. Checking /tmp (/private/tmp) shows the sticky bit is on it. But forcing the group to be wheel (which I expect that to happen) is not what Wikipedia (quoting a Leopard man page) says it will do. And preventing me from changing the group on the copy is neither. The copy ends up with the same owner—me—and my group—staff—so it actually *did* what it said was not permitted. I can see a rationale for what the man page says, but why does the error message say that something different was not allowed when it actually did exactly that? And why are files in /tmp created with group wheel when that is not what the sticky bit is for? /tmp is root/wheel as expected, WGroleau@MBP ~ % ls -latde@ /private/tmp drwxrwxrwt 7 root wheel 224 Dec 21 09:58 /private/tmp but the doc mentioned says that sticky bit prevents deletion by someone else but the owner. Since I was the owner, that doesn't matter. But it doesn't say what I *thought* it meant, which was to override the creator's group. However, the latter is what did happen. And then the error message falsely states that it was not able to change the group to mine. Not sure whether changing the group is required when the destination does not have a sticky bit: WGroleau@MBP ~ % ls -late@d /Volumes/Sidecar/Sort_By_Date/2017年/06月/08日 drwxrwxr-x 16 WGroleau staff 512 Dec 20 23:35 /Volumes/Sidecar/Sort_By_Date/2017年/06月/08日
Asked by WGroleau (5370 rep)
Dec 21, 2022, 07:57 AM
Last activity: Dec 22, 2022, 07:59 AM