2

I have a MacBook Pro with an external USB hard drive. A program I wrote is having trouble reading the files in Backups.backupdb so I look at the permissions:

> pwd
/Volumes/G-DRIVE
> ls -led Backups.backupdb 
drwxr-xr-x+ 7 rob  staff  238 Feb 10  2012 Backups.backupdb
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

This is an older drive. I no longer use it for Time Machine backups, so I don't care if I clear out permissions that used to protect this folder

But I can't clear them:

> sudo chmod -N Backups.backupdb
> chmod: Failed to clear ACL on file Backups.backupdb: Operation not permitted

Attempts to find some hidden attribute that might be preventing the chmod:

> ls -ldO Backups.backupdb 
> drwxr-xr-x+ 7 rob  staff  - 238 Feb 10  2012 Backups.backupdb
> xattr Backups.backupdb 
[nothing]

Why is the operation not permitted?

I just used Disk Utility to look at the drive. It didn't find any problems.

Rob N
  • 181
  • 1
  • 8

2 Answers2

4

I found an answer to my own question.

I don't know if this is new to macOS 11 Big Sur. I had to go to System Preferences → Security & Privacy → the Privacy tab. Then select "Full Disk Access" in the list on the left, and enable the checkbox for Terminal. It restarted Terminal and then I was able to run the usual commands to chmod, as well as view the directory contents.

Rob N
  • 181
  • 1
  • 8
1

Being unable to do operations even with sudo is usually caused by System Integrity Protection. This answer describes a similar issue, and also describes how to disable SIP (and re-enable it when you're done).

Dylan McNamee
  • 493
  • 4
  • 16
  • I don't think it's SIP. If it were, I should see that `rootless` attr when I run `xattr`, but there's nothing there. – Rob N Oct 05 '20 at 20:27
  • Perhaps. Have you investigated `chflags` ? Here's an answer that describes another similar issue: https://stackoverflow.com/a/7545798/6423998 – Dylan McNamee Oct 05 '20 at 20:50
  • That `ls -ldO` command that I show in my question shows there are no flags on the directory. – Rob N Oct 05 '20 at 21:49