MacOS – “Operation not permitted” for root when trying to ls or chmod -R /Users/user/Desktop

catalinacommand linemacospermissionterminal

"user" can't do it either. Permission of Desktop/ is set to 700 and owned by "user". Here's the sderr output for ls -R command in the home directory:

ls: Desktop: Operation not permitted
ls: AddressBook: Operation not permitted
ls: CallHistoryDB: Operation not permitted ls:
CallHistoryTransactions: Operation not permitted
ls: com.apple.TCC:
Operation not permitted
ls: com.apple.sharedfilelist: Operation not
permitted
ls: CloudKit: Operation not permitted ls:
com.apple.ap.adprivacyd: Operation not permitted
ls: Calendars:
Operation not permitted
ls:
com.apple.CloudDocs.MobileDocumentsFileProvider: Operation not
permitted
ls: com.apple.Home: Operation not permitted
ls:
com.apple.Safari: Operation not permitted
ls: com.apple.news:
Operation not permitted
ls: Cookies: Operation not permitted
ls:
HomeKit: Operation not permitted
ls: IdentityServices: Operation not
permitted ls: Mail: Operation not permitted
ls: Messages: Operation
not permitted
ls: CoreSpotlight: Operation not permitted
ls:
PersonalizationPortrait: Operation not permitted
ls: Safari: Operation
not permitted
ls: Sharing: Operation not permitted
ls: Suggestions:
Operation not permitted

Best Answer

You need to add Terminal to the list of apps that have Full Disk Access in the Privacy pane of System Preferences > Security & Privacy.

Unlock the padlock in the bottom left, and drag the Terminal app icon onto the window.

Privacy pane