I've somehow managed to cut myself (and the superuser???) off from my ~/Downloads
directory in the Terminal.
- I did not purposefully enter any Unix commands to change permissions or access.
- I did install a download helper in my Brave browser at around that time and use it to download an audio file to that directory. (The audio file ended up being corrupted.)
- I can still access and manipulate the folder using Finder.
Here's how it looks with some context in the Terminal:
drwx------+ 10 dmg staff 320 Sep 4 22:31 Desktop/
drwx------+ 41 dmg staff 1312 Aug 8 07:10 Documents/
drwx------+ 4 dmg _lpoperator 128 Sep 9 14:58 Downloads/
drwx------+ 79 dmg staff 2528 Aug 29 17:47 Library/
Here are a variety of things that are now weird about the directory in the Terminal.
~$ /bin/ls Downloads/
ls: Downloads/: Operation not permitted
~$ chgrp staff Downloads/
chgrp: Downloads/: Operation not permitted
~$ sudo /bin/ls Downloads/
Password:
ls: Downloads/: Operation not permitted
~$ sudo chgrp staff Downloads/
chgrp: Downloads/: Operation not permitted
~$ xattr Downloads/
xattr: [Errno 1] Operation not permitted: 'Downloads/'
~$ cd Downloads/
~/Downloads$ /bin/ls -al
total 0
ls: .: Operation not permitted
~/Downloads$ cd ..
~$
I can't recall whether the Unix group of the directory was staff
or _lpoperator
before whatever I did to the directory (but I'm a member of both groups anyway).
Notice that I can cd
to the directory okay and also that I can access the ..
pointer to cd
back out.
In 27 years of using Unix systems and 20 years of OS X experience, I've never encountered a permissions issue that I couldn't fix with sudo
in the Terminal. I'm at a loss as to how to proceed.
If the directory weren't "special" in MacOS's eyes, I would just erase it and create a new one.
P.S. This is on Monterey 12.5.1 on a brand new M1 MacBook Pro.
::EDIT::
Thanks to this question that was suggested in the sidebar, I just learned about System Integrity Protection. So, in an effort to solve the problem (without actually figuring out what went wrong) I turned SIP off.
With SIP off, as root
I was able to delete the Downloads directory and then recreate it.
However, before I deleted the directory I was able to list its contents. To reiterate, with SIP off before "fixing" anything I was able to take an action that I was not able to do with SIP on. This suggests that whatever I broke somehow caused SIP to think that listing the contents of ~/Downloads
in Terminal was not an approved action.
In any case, I have resolved the problem (through brute force), but I still don't understand what I did to cause it in the first place.
umask
is 0077, so dirs end up 700, regular files end up 500, and executable files end up 700. – dg99 Sep 09 '22 at 21:44ls -leO@ ~
)? – Gordon Davisson Sep 09 '22 at 22:08com.apple.macl 72
, but remember that I've already deleted and recreated it. I no longer have access to the problematic version. – dg99 Sep 10 '22 at 01:38