本文介绍了PATH 中不安全的世界可写目录/Users/username,运行 Ruby 命令时模式为 040777的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行像 gem -v 这样的 Ruby 命令时,我得到这个错误:

When I run Ruby commands like gem -v I get this error:

/Users/kristoffer/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4:警告:不安全的世界可写目录/Users/kristoffer 在 PATH,模式 040777

1.6.2

首先我不明白这是什么意思.根据 echo $PATH,/Users/kristoffer 不在我的路径中.echo $PATH 的结果是:

First of all I don't understand what this means. /Users/kristoffer is not in my path according to echo $PATH. The result of echo $PATH is:

/Users/kristoffer/.rvm/gems/ruby-1.9.2-p180/bin:/Users/kristoffer/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/kristoffer/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/kristoffer/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

如您所见,PATH 非常干净.只是默认路径+ RVM 添加的内容.

As you can see, the PATH is pretty clean. Just the default path + what RVM added.

我看过与此类似的其他帖子,其中推荐的解决问题的方法是运行 chmod go-w path/to/folder

I've seen the other posts similar to this where the recommended way to solve the issue is to run chmod go-w path/to/folder

但是,我很确定让我的主文件夹不可写是个坏主意,对吧?我已经使用磁盘工具修复了权限,但没有发现我的主文件夹的权限有任何问题.

However, I'm pretty sure that it's a bad idea to make my Home folder non-writeable, right? I've repaired permissions using Disk Utility and it didn't find anything wrong with the permissions on my Home folder.

知道问题是什么以及我该如何解决吗?

Any idea of what the problem is and how I can fix it?

推荐答案

您的主文件夹应该只能由您写入,而不能由其他任何人写入.gem 抱怨这个的原因是你的 PATH 中有一些文件夹在你的(不安全的)主文件夹中,这意味着任何想要通过重命名/移动你的 .rvm 文件夹并用冒名顶替者替换它来入侵你的人.

Your home folder should only be writable by you, not by anyone else. The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor.

要修复您的主文件夹,请运行 chmod go-w/Users/kristoffer.如果在通往 PATH 中任何内容的途中还有任何其他不安全的文件夹,您应该类似地修复它们.

To fix your home folder, run chmod go-w /Users/kristoffer. If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly.

顺便说一句,磁盘工具没有修复这个的原因是它只修复作为操作系统一部分安装的文件(参见 Apple 关于该主题的知识库文章).如果您从安装 DVD 启动并从实用工具"菜单运行密码重置",则可以选择修复主文件夹权限,但我不确定它是自行重置权限还是仅重置所有权.

BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership.

这篇关于PATH 中不安全的世界可写目录/Users/username,运行 Ruby 命令时模式为 040777的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 03:46