首页 > 解决方案 > 当`sudo`和`bypass`不起作用时如何避免macOS上的“不允许操作”

问题描述

在 macOS(High Sierra)上,当我尝试在路径中列出文件时

/private/var/db/ConfigurationProfiles/Store

我收到错误“ Operation not permitted”。使用sudo并不能改善它,甚至使用bypass助手也不会改变任何东西:

sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass ls -l /private/var/db/ConfigurationProfiles/Store

也给出“ Operation not permitted”。如何列出/访问路径下的文件/private/var/db/ConfigurationProfiles/Store

附加信息:

通过ls -al /private/var/db/ConfigurationProfiles显示的封闭目录的列表:

drwxr-xr-x   5 root  wheel   160 13 Apr  2018 .
drwxr-xr-x  85 root  wheel  2720 28 Sep 06:27 ..
drwxr-xr-x@  4 root  wheel   128 16 Dec  2017 Settings
drwx------   3 root  wheel    96  1 Oct 21:56 Setup
ls: Store: Operation not permitted

始终如一,但奇怪的Store是无法列出。ls以当前用户身份执行和通过时都会发生这种情况sudo

标签: macosfile-iosudo

解决方案


最可能的原因是系统完整性保护 (SIP) -csrutil是命令行实用程序。您需要禁用它才能查看目录。

  • 要查看您的状态,您需要:

csrutil status

  • 要禁用它(这通常是个主意):

csrutil disable(那么您可能需要重新启动)。

  • 要启用它(完成后应重新打开):

csrutil enable


推荐阅读