简体   繁体   English

在PATH中获取警告“不安全世界可写dir / home / chance”,模式040777用于rails和gem

[英]Getting the warning “Insecure world writable dir /home/chance ” in PATH, mode 040777 for rails and gem

I've tried this but it didn't work and seemed to be for osx. 我试过这个,但它没有用,似乎是osx。 I have a fresh Ubuntu 10.10 install with rvm, rails 3 and ruby 1.9.2. 我有一个新的Ubuntu 10.10安装与rvm,rails 3和ruby 1.9.2。 I have a fresh rails app but using either gem or rails results in the following warnings (with lag). 我有一个新的rails应用程序,但使用gem或rails会导致以下警告(滞后)。

$ 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 $ 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

Just incase it matters, here is my Gemfile: 只是重要的是,这是我的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

If you tried sudo chmod go-w /usr/local/bin from the other answer, try: 如果您从其他答案尝试了sudo chmod go-w /usr/local/bin ,请尝试:

chmod go-w /home/chance

instead. 代替。

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. 似乎已经发生的事情是,你的主目录( /home/chance )已被添加到$PATH (操作系统在尝试查找要启动的可执行文件时搜索的目录列表),并且还更改了其权限,以便任何人都可以写信给它。 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. Ruby注意到这一点并发出警告。

This command changes the permissions of the directory so that it is no longer world writable. 此命令更改目录的权限,以使其不再是全局可写的。

In unix, file permissions are specified for three categories, the file owner (user), the group of the file (group), and everyone else (other). 在unix中,为三个类别指定文件权限,文件所有者(用户),文件组(组)和其他所有人(其他)。 (See Google for more on unix file permissions). (有关unix文件权限的更多信息,请参阅Google)。

So breaking down the command above: 所以打破上面的命令:

chmod - change the 'mode' of the file (ie its permissions) chmod - 更改文件的“模式”(即其权限)

go - for group(g) and others(o) go - 为组(g)和其他人(o)

-w - (minus w) remove write permission -w - (减去w)删除写入权限

/home/chance - the file (or directory) in question /home/chance - 有问题的文件(或目录)

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. 在另一个答案中,导致问题的目录是/usr/local/bin ,它由root拥有,因此sudo需要更改它的权限。 /home/chance is your home directory which is owned by the chance user who can change permissions on it - no sudo required. /home/chance是您的主目录,由可以更改权限的chance用户拥有 - 不需要sudo

You use the chmod go-w to whatever path the terminal gives you. 您可以将chmod go-w用于终端为您提供的任何路径。

So if it says /usr/local as the path in the error message: 因此,如果它将/ usr / local称为错误消息中的路径:

warning: Insecure world writable dir /usr/local in PATH, mode 040777

You write 你写

chmod go-w /usr/local

我不得不使用-R来修复我的:

chmod -R go-w /Users/username

(If you are in a Mac) Try the option "Repair Disk Permissions" from the disk utility (如果您在Mac中)尝试从磁盘实用程序中选择“修复磁盘权限”

在此输入图像描述

Probably a couple of lines in the details log will say: 细节日志中的几行可能会说:

Permissions differ on “usr”; should be drwxr-xr-x ; they are drwxrwxrwx.
Repaired “usr”

I'm in a Mac, so /home/ username did not work for me. 我在Mac上,所以/ home / username对我不起作用。 However, when I tried to changing permissions for /User/ username , the error persisted. 但是,当我尝试更改/ User / username的权限时,错误仍然存​​在。

The thing that got it working was chmod go-w /User/username/.rvm 让它运作的是chmod go-w /User/username/.rvm

如果您的环境不允许您正确修复此错误(即ruby存在于网络共享或某些此类错误上),请参阅此答案以获取抑制错误的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:PATH模式040777下不安全的世界可写目录/ usr - warning: Insecure world writable dir /usr in PATH, mode 040777 警告:PATH中的不安全世界可写dir / usr / local / bin,模式040777 - warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 运行“rails s”后如何修复“路径中不安全的世界可写目录/mnt/c,模式040777”错误 - How to fix "Insecure world writable dir /mnt/c in PATH, mode 040777" error after running "rails s" Rails“不安全的世界可写目录dir /Library/Ruby/Gems/1.8 in PATH,模式040777 - Rails "Insecure world writable dir /Library/Ruby/Gems/1.8 in PATH, mode 040777 Rails-警告:不安全的世界可写目录 - Rails - Warning : Insecure world writable dir 警告:当我运行ruby或gem命令时,不安全的世界可写dir - warning: Insecure world writable dir when I run a ruby or gem command 运行rails或rails -v时获取不安全的世界可写目录 - Getting Insecure world writable dir when running rails s or rails -v 耙任务提示不安全的可写目录 - Rake tasks prompt insecure writable dir 在做rails时,我不断收到不安全的世界可写错误 - While doing rails s, I keep getting Insecure world writeable error Rails新版GEM_HOME - Rails new GEM_HOME
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM