macos /usr/local/lib 的 OS X 权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3391722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:06:42  来源:igfitidea点击:

OS X permission denied for /usr/local/lib

linuxmacososx-snow-leopardfile-permissions

提问by Cliff

I'm looking for any advice/intuition/clues/answers on a permission issue that has been plaguing me ever since I switched over to a new Macbook pro. Here's the dilemma. Certain programs copy libraries under /usr/local/lib during install and upon running these programs I get a crash which I believe is related to permission restrictions to files in this folder. I've had errors (can't access files from this path) trying to install plugins for audacity and then tried doing an "ls" under this folder. I immediately get permission denied unless I prefix the cmd with sudo. I've tried owning the /usr/local/lib/audacity folder with my user account and even still I get permissions errors on these files. It's important to note that the problem is not exclusive to Audacity. I've seen the same problem with Polycom video conference software and I've also been unable to run Parallels on this machine. (I haven't traced Parallels to the same issue but I'm betting its related.) I vaguely recall some weird Linux cmd magic I used to use back in the day that would not only grant permission to a user but tweak some low level bits allowing/disabling certain things like execution and I seem to recall the permission thing ran deeper than execution but its been years. I can't recall the detils and I'm wondering if there's something similar on OS X that I'm possibly overlooking. Is there something special about that location and the files there in? Could I have somehow altered my file system in a way tht the files appear different? For what its worth, I seem to be able to use at least one of the programs if I log in as root. I haven't tried with the other programs as I've just discovered the ability. Please help.

我正在寻找关于许可问题的任何建议/直觉/线索/答案,自从我切换到新的 Macbook pro 以来,这个问题一直困扰着我。这就是困境。某些程序在安装期间复制 /usr/local/lib 下的库,并且在运行这些程序时出现崩溃,我认为这与对该文件夹中文件的权限限制有关。我在尝试为 audacity 安装插件时遇到错误(无法从该路径访问文件),然后尝试在该文件夹下执行“ls”。除非我在 cmd 前面加上 sudo 前缀,否则我会立即获得权限被拒绝。我试过用我的用户帐户拥有 /usr/local/lib/audacity 文件夹,即使我仍然收到这些文件的权限错误。需要注意的是,这个问题并不是 Audacity 独有的。一世' 我在 Polycom 视频会议软件上看到了同样的问题,我也无法在这台机器上运行 Parallels。(我没有将 Parallels 追溯到同一问题,但我打赌它是相关的。)我依稀记得我曾经使用过的一些奇怪的 Linux cmd 魔法,它不仅会授予用户权限,还会调整一些低级别位允许/禁用某些事情,如执行,我似乎记得许可的事情比执行更深入,但已经多年了。我不记得细节了,我想知道 OS X 上是否有我可能忽略的类似内容。该位置和其中的文件有什么特别之处吗?我能不能以某种方式改变我的文件系统,使文件看起来不同?物有所值,如果我以 root 身份登录,我似乎至少可以使用其中一个程序。我还没有尝试过其他程序,因为我刚刚发现了这种能力。请帮忙。

回答by Cfreak

It sounds like the folder isn't world executable. Try:

听起来该文件夹不是世界可执行的。尝试:

sudo chmod 755 /usr/local/lib

and then you should be able to use ls or anything else in the folder (still won't allow you to write but your user account shouldn't be able to do that anyway)

然后您应该能够使用 ls 或文件夹中的任何其他内容(仍然不允许您写入,但您的用户帐户无论如何都不能这样做)

回答by Cliff

Found the answer from a coworker buddy. The folder needed to be marked executable.

从同事那里找到了答案。该文件夹需要标记为可执行。

sudo chmod 755 /usr/local/lib

fixes everything!

修复一切!