1

My /tmp directory became unwritable yesterday, I believe that the permissions are all set correctly:

$ ls -l / 
lrwxr-xr-x@  1 root  wheel   11 Sep 22 16:05 tmp -> private/tmp
$ ls -l /private
drwxrwxrwt@  3 root  wheel   102 Oct 17 15:04 tmp

$ ls -leO@d /private/tmp
drwxrwxrwt@ 3 root  wheel  restricted 102 Oct 17 15:04 /private/tmp
com.apple.rootless    0

However, I get an error when I attempt to write into this directory, even with sudo:

$ cd /tmp
$ pwd
/tmp
$ sudo cat > test
-bash: test: Operation not permitted

I'm using OS X El Capitan 10.11.6. Any help is much appreciated- thanks!

Edit: after following fd0's suggestion, it looks like the directory might be rootless, which I suppose is related to SIP and may be why root cannot make changes. I note that the contents that I see in the /tmp directory appear to be related to App Store automatic download to be used to upgrade my Mac to Sierra if I request it in the future: perhaps something broke during this App Store process? I'm still not sure how to correct my system, though.

Edit2: I solved this problem by upgrading to Sierra. Probably the steps linked to by Slava below would mostly work but it sounds like the extended attributes would be lost so I chose to upgrade instead.

3
  • Add the following command and the results to your post- ls -leO@d /private/tmp
    – fd0
    Oct 18, 2016 at 19:59
  • 1
    What does rootless mean?
    – mmmmmm
    Oct 19, 2016 at 17:00
  • 1
    rootless is an extended attribute added by Apple as part of System Integrity Protection (SIP). Files/directories attributed with rootless cannot be modified, even by root, while SIP is enabled. Oct 19, 2016 at 20:47

1 Answer 1

2

Recreation the link /tmp -> /private/tmp helped me (with csrutil disabled in recovery mode) : https://superuser.com/questions/1133065/unable-to-write-to-tmp-osx-unable-to-correct-permissions-operation-not-permitt#comment1629612_1133065

Looks like the Sierra installer makes /tmp rootless if you download and cancel it on the very first step of installation.

2
  • Thanks! I believe that the /tmp directory is supposed to be rootless. The steps you link to appear to leave /tmp non-rootless. I'll probably go ahead and do those steps unless I can find a fix that leaves the extended attributes intact. Oct 18, 2016 at 22:40
  • The last sentence is what also applied to my case. Thanks a lot!
    – Timotei
    Oct 21, 2016 at 0:02

You must log in to answer this question.

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