Ruby-on-rails 警告:PATH 中不安全的世界可写目录 /usr/local/bin,模式 040777
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3952243/
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
warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
提问by Xandman
Every time I run this command rails server:
每次我运行这个命令时rails server:
warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
警告:PATH 中不安全的世界可写目录 /usr/local/bin,模式 040777
I searched for a solution here and they said to type: chmod go-w /usr/local/bin
我在这里搜索了一个解决方案,他们说输入: chmod go-w /usr/local/bin
But I get this error:
但我收到此错误:
chmod: Unable to change file mode on /usr/local/bin: Operation not permitted
chmod:无法更改 /usr/local/bin 上的文件模式:不允许操作
I am using OS X by the way.
顺便说一下,我正在使用 OS X。
回答by Jonathan Leffler
You will need to have root access to do this. If you aren't already the administrative user, login as the administrator. Then use 'sudo' to change the permissions:
您需要具有 root 访问权限才能执行此操作。如果您还不是管理员用户,请以管理员身份登录。然后使用“sudo”更改权限:
sudo chmod go-w /usr/local/bin
Obviously, that will mean you can no longer install material in /usr/local/bin except via 'sudo', but you probably shouldn't be doing that anyway.
显然,这意味着您不能再在 /usr/local/bin 中安装材料,除非通过“sudo”,但您可能无论如何都不应该这样做。
回答by peterk
I had the same error here MacOSX 10.6.8 - it seems ruby checks to see if any directory (including the parents) in the path are world writable. In my case there wasn't a /usr/local/bin present as nothing had created it.
我在 MacOSX 10.6.8 中遇到了同样的错误 - 似乎 ruby 会检查路径中是否有任何目录(包括父目录)是全局可写的。在我的情况下,没有 /usr/local/bin 存在,因为没有创建它。
so I had to do
所以我不得不这样做
sudo chmod 775 /usr/local
to get rid of the warning.
摆脱警告。
A question here is does any non root:wheel process in MacOS need to create anything in /usr/local ?
这里的问题是 MacOS 中的任何非 root:wheel 进程是否需要在 /usr/local 中创建任何内容?
回答by Larry Hynes
I have had the same issue in OSX. It can be fixed by running Disk Utilities to Repair Permissions. I agree with Peter Nixey: in my case it is caused when my 3G dongle installs or reinstalls its driver. Repairing Permissions afterward fixes the issue.
我在 OSX 中遇到了同样的问题。它可以通过运行磁盘实用程序来修复权限来修复。我同意 Peter Nixey 的观点:就我而言,这是由我的 3G 加密狗安装或重新安装其驱动程序引起的。之后修复权限可解决此问题。
回答by Muendo
Am using Mountain Lion. What I did was Look for /usr/local and Get Info. On it there is Sharing and Permissions. Make sure that its only the user and Admin are the only ones who have read and write permissions. Anyone else should have read access only. That sorted my problem.
正在使用山狮。我所做的是查找 /usr/local 并获取信息。上面有共享和权限。确保只有用户和管理员才有读写权限。其他任何人都应该只有读取权限。那解决了我的问题。
Its normally helpful is your Run disk utilities and repair permissions too.
它通常有用的是您的运行磁盘实用程序和修复权限。
回答by Jander
Try: sudo chmod go-w /usr/local/bin
尝试: sudo chmod go-w /usr/local/bin
The /usr/local/bin directory is owned by the root(i.e. administrator) account, so even if you can write to it, you can't change the permissions on it. The sudocommand means "run the following command as root", and works a lot like clicking that lock icon in the System Preferences dialogs.
/usr/local/bin 目录由root(即管理员)帐户拥有,因此即使您可以对其进行写入,也无法更改其权限。该sudo命令的意思是“以 root 身份运行以下命令”,其工作方式与单击“系统偏好设置”对话框中的锁定图标非常相似。
回答by Jai Kumar Rajput
You need to run
你需要跑
sudo chmod o-w -R /usr/local
回答by Mister P
Same here, apparently my /usr/local folder was world writable so I made it 755
同样在这里,显然我的 /usr/local 文件夹是全局可写的,所以我将其设为 755
# chmod 755 /usr/local
It also appeared that a Hauwei mobile dongle I had used had installed world writeable directories in /usr/local as well
看来我用过的华为手机加密狗也在 /usr/local 中安装了世界可写目录
回答by Kyle Hotchkiss
If you're running OSX and getting this often, another good thing to consider is to use a built-in OSX permissions fixing tool. If you didn't change the mode of your directories, something else did and there's a chance that other directories have overgenerous permissions as well - this tool will reset them back all to factory defaults, which is a good security idea. There's a great guide on the Apple stackextange about this very process.
如果您正在运行 OSX 并且经常遇到这种情况,另一个需要考虑的好处是使用内置的 OSX 权限修复工具。如果您没有更改目录的模式,则进行了其他操作,并且其他目录也可能具有过多的权限 - 此工具会将它们全部重置为出厂默认值,这是一个很好的安全想法。Apple stackextange 上有一个关于这个过程的很好的指南。
回答by arkiver
Even I came across similar problem. I use KDE on ubuntu 12 and while playing around in my home folder I had accidently changed permissions for Group and Others as "can view and modify content" by right clicking in my home folder and then properties and forgot all about it.
即使我遇到了类似的问题。我在 ubuntu 12 上使用 KDE,在我的主文件夹中玩耍时,我意外地将组和其他人的权限更改为“可以查看和修改内容”,方法是右键单击我的主文件夹,然后单击属性,然后忘记了所有这一切。
My warning was:
我的警告是:
warning: Insecure world writable dir /home/my_home_folder in PATH, mode 040777
So in my case it was the home folder. I did undid the modifications of permissions and I stopped getting those warnings when running the rails server or rake tasks to run my tests.
所以就我而言,它是主文件夹。我确实取消了权限的修改,并且在运行 rails 服务器或 rake 任务来运行我的测试时不再收到这些警告。
回答by Sayanee
I'm also having the exact same problem with both /usr/local/bin and /etc/sudoers on OSX Snow lepard.Even when i logged in as admin and tried to change the permissions via the terminal, it still says "Operation not permitted". And i did the following to get the permission of these folders.
我在 OSX Snow lepard 上的 /usr/local/bin 和 /etc/sudoers 也有完全相同的问题。即使我以管理员身份登录并尝试通过终端更改权限,它仍然显示“操作不允许”。我做了以下操作以获得这些文件夹的权限。
From the terminal, I accessed /etc/sudoers file and using pico editor i added the following code: username ALL=(ALL) ALL Replace "username" with your MAC OS account name
从终端,我访问了 /etc/sudoers 文件并使用 pico 编辑器添加了以下代码:username ALL=(ALL) ALL 将“username”替换为您的 MAC OS 帐户名

