避开权限错误

更强

在Ubuntu中,无论何时遇到权限错误,我通常以sudo的身份运行命令。在OSX中不是这样:

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
 From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'Library/Aliases/0mq' (Permission denied)

作为sudo:

$ sudo ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
-e:69: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Don't run this as root!

不知道我该怎么做。我一直都在碰这种事情,而在我可以找到sudo chown相关目录的同时,我会一直在做。

我既不能sudo brew install作为Brew的“胆小鬼拒绝”来作为超级用户使用。我只是感到困惑,因为我感觉自己正在尝试做一些愚蠢的事情,但是等效于Ubuntu的这sudo apt-get install被认为是安装新应用程序的正确方法吗?

我还可以创建一个实际上是超级用户的新用户并以他的身份安装东西,但是Ubuntu不允许您这样做,因为这是一个坏主意,我同意让能力有限的用户只能在需要时才对它进行嘲弄好得多的主意。

Lqueryvg

/usr/local/不应是世界可写的;这是一件坏事-错误/警告消息指出它是正确的。(我想知道首先是怎么做到的?)

另外,您不必总是求助于目录-您应将用户/组的所有权和权限视为难题。

在这种情况下,建议您从/ usr / local中删除世界写入位,然后重试。

sudo chmod o-w /usr/local

编辑:

我在您尝试运行的脚本中找到了这个。

This script requires the user #{ENV['USER']} to be an Administrator. If this
sucks for you then you can install Homebrew in your home directory or however
you please; please refer to our homepage. If you still want to use this script
set your user to be an Administrator in System Preferences or `su' to a
non-root user with Administrator privileges.

因此,建议您暂时将自己添加为管理员。我认为这可能只是将您添加到管理组中。如果是这样,您还可以使/ usr / local(及其任何其他子目录)组由admin组中的任何人拥有/可写。

sudo chgrp admin /usr/local
sudo chmod g+w /usr/local

从安全的角度来看,这比一揽子变更更容易接受。我看过一些“解决方案”,人们将整个/ usr / local内容整理成自己的ID。

鸣喇叭鸣喇叭。

或以另一种方式(如上所述)将其以非root用户身份安装到某个位置的主目录中。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章