问题描述
我已经尝试过 this 但它没有用,而且似乎是对于 osx.我有一个带有 rvm、rails 3 和 ruby 1.9.2 的全新 Ubuntu 10.10 安装.我有一个新的 rails 应用程序,但使用 gem 或 rails 会导致以下警告(有滞后).
I've tried this but it didn't work and seemed to be for osx. I have a fresh Ubuntu 10.10 install with rvm, rails 3 and ruby 1.9.2. I have a fresh rails app but using either gem or rails results in the following warnings (with lag).
$ rails -v
$ rails -v
/home/chance/.rvm/gems/ruby-1.9.2-p180@global/gems/railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /home/chance in PATH, mode 040777
/home/chance/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.10/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /home/chance in PATH, mode 040777
Rails 3.0.5
<小时>
$ gem -v
/home/chance/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4: warning: Insecure world writable dir /home/chance in PATH, mode 040777
1.6.2
以防万一,这是我的 Gemfile:
Just incase it matters, here is my Gemfile:
source 'http://rubygems.org'
gem 'rails'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem "haml"
gem "formtastic"
gem "will_paginate"
gem "devise"
gem "delayed_job"
gem "whenever"
gem "memcache-client"
gem "capistrano"
group :testing do
gem "rspec"
gem "rspec-rails"
gem "autotest-standalone"
gem "autotest-rails"
gem "autotest-growl"
gem "mocha"
gem "shoulda"
gem "factory_girl_rails"
end
group :development do
gem "cheat"
gem "bullet"
gem "ruby-growl"
end
推荐答案
如果您从其他答案尝试 sudo chmod go-w/usr/local/bin
,请尝试:
If you tried sudo chmod go-w /usr/local/bin
from the other answer, try:
chmod go-w /home/chance
改为.
似乎发生的事情是,您的主目录 (/home/chance
) 已被添加到您的 $PATH
(操作系统搜索时的目录列表)试图找到要启动的可执行文件)并且还更改了其权限,以便任何人都可以写入它.这是一个潜在的安全问题,因为另一个用户可能会将可执行文件放入此目录中,而您可能会意外启动它.Ruby 注意到这一点并发出警告.
What seems to have happened is that somehow your home directory (/home/chance
) has been added to your $PATH
(the list of directories the OS searches when trying to find an executable to launch) and has also had its permissions changed so that anyone can write to it. This is potential a security problem, as another user could put an executable into this directory which you could accidentally launch. Ruby notices this and issues the warning.
此命令更改目录的权限,使其不再是全局可写的.
This command changes the permissions of the directory so that it is no longer world writable.
在 unix 中,文件权限被指定为三个类别,文件所有者(用户)、文件所属的组(组)和其他所有人(其他).(有关 unix 文件权限的更多信息,请参阅 Google).
In unix, file permissions are specified for three categories, the file owner (user), the group of the file (group), and everyone else (other). (See Google for more on unix file permissions).
所以分解上面的命令:
chmod
- 更改文件的模式"(即其权限)
chmod
- change the 'mode' of the file (i.e. its permissions)
go
- 用于组(g)和其他(o)
go
- for group(g) and others(o)
-w
-(减w)删除写权限
-w
- (minus w) remove write permission
/home/chance
- 有问题的文件(或目录)
/home/chance
- the file (or directory) in question
在另一个答案中,导致问题的目录是 /usr/local/bin
,它归 root 所有,因此需要 sudo
来更改它的权限./home/chance
是您的主目录,由 chance
用户拥有,该用户可以更改其权限 - 不需要 sudo
.
In the other answer the directory that was causing the problem was /usr/local/bin
, which is owned by root so sudo
is required to change permissions on it. /home/chance
is your home directory which is owned by the chance
user who can change permissions on it - no sudo
required.
这篇关于收到警告“不安全的世界可写目录/home/chance"在 PATH 中,用于 rails 和 gem 的模式 040777的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,WP2