RVM 权限被拒绝错误
Posted
技术标签:
【中文标题】RVM 权限被拒绝错误【英文标题】:RVM permission denied error 【发布时间】:2015-09-16 20:40:32 【问题描述】:我在运行 Debian 7 的机器上完成了 RVM 的多用户安装。我在机器上的项目使用 ruby v2.2.2 和 gemset。我的项目根目录中有一个 .ruby-version 文件,其内容为 2.2.2@my-project-name
现在,当我 cd 进入我的项目目录时,我收到以下错误:
Regenerating ruby-2.2.2 wrappers........
rm: cannot remove `/usr/local/rvm/gems/ruby-2.2.2/environment': Permission denied
/usr/local/rvm/scripts/functions/environment: line 93: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 100: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 100: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
/usr/local/rvm/scripts/functions/environment: line 99: /usr/local/rvm/gems/ruby-2.2.2/environment: Permission denied
有什么办法解决这个问题?
请帮忙 谢谢。
【问题讨论】:
你介意分享/usr/local/rvm/scripts/functions/environment
大约 90:100 行吗?
【参考方案1】:
在我的例子中,我不小心安装了一个新版本的 Ruby,使用 root 而不是受限用户。
你可以这样解决这个问题:
通过 SSH 登录到您的服务器并转到目录/usr/local/rvm/gems/
并查看以前版本的用户:
sreuter@localhost:/usr/local/rvm/gems$ ls -lah
total 28K
drwxrwsrwx 7 root rvm 4.0K Mar 29 14:32 .
drwxrwsrwx 26 root rvm 4.0K Feb 21 14:10 ..
...
drwxrwsr-x 10 sreuter rvm 4.0K Mar 29 13:36 ruby-2.4.0
lrwxrwxrwx 1 sreuter rvm 52 Feb 24 07:05 ruby-2.4.0@global -> /usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0
drwxrwsr-x 10 root rvm 4.0K Mar 29 14:45 ruby-2.4.1
lrwxrwxrwx 1 root rvm 52 Mar 29 14:32 ruby-2.4.1@global -> /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0
您会看到最新的目录ruby-2.4.1
及其符号链接属于root,而不是其他目录的受限用户。
如下更改用户:
sudo chown -R sreuter:rvm ruby-2.4.1*
(根据需要更改用户和组名)
【讨论】:
以上是关于RVM 权限被拒绝错误的主要内容,如果未能解决你的问题,请参考以下文章