我在我的服务器上使用 RVM 来管理 ruby。我有一个 gem,它是一个守护进程,我想以非特权用户身份运行,但是,当我尝试这样做时,出现权限错误:
statusbot@host config]$ statusbot run
fatal: Not a git repository (or any of the parent directories): .git
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/definition.rb:235:in `rescue in lock': There was an error while trying to write to Gemfile.lock. It is likely that (Bundler::InstallError)
you need to allow write permissions for the file at path:
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/StatusBot-0.0.4/Gemfile.lock
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/definition.rb:220:in `lock'
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/environment.rb:34:in `lock'
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler/runtime.rb:43:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/bundler-1.3.2/lib/bundler.rb:120:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/rubygems-bundler-1.1.1/lib/rubygems-bundler/noexec.rb:79:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p374/gems/rubygems-bundler-1.1.1/lib/rubygems-bundler/noexec.rb:91:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:9:in `<main>'
同样,我无法为每个用户安装 gems:
[statusbot@host ~]$ gem install ~/StatusBot-0.0.5.gem
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /usr/local/rvm/gems/ruby-1.9.3-p374/gems/StatusBot-0.0.5