rails s - 权限被拒绝

时间:2017-11-29 09:25:23

标签: ruby-on-rails sudo

我创建了一个rails应用,但我无法执行rails serverrake routes,错误是:/home/charles/.rbenv/shims/rails: ligne 21: /root/.rbenv/libexec/rbenv: Permission non accordée

去上班但这样做并不好。

使用visudo我有这个,我当前的用户charles具有用户权限:#

# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sb$

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
charles ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

ls -l输出:

➜  alpha_blog git:(master) ✗ ls -l 
total 68
drwxr-xr-x 10 charles charles 4096 nov.  15 16:52 app
drwxr-xr-x  2 charles charles 4096 nov.  15 16:52 bin
drwxr-xr-x  5 charles charles 4096 nov.  15 16:52 config
-rw-r--r--  1 charles charles  130 nov.  15 16:52 config.ru
drwxr-xr-x  2 charles charles 4096 nov.  15 16:52 db
-rw-r--r--  1 charles charles 1974 nov.  15 16:52 Gemfile
-rw-r--r--  1 charles charles 4772 nov.  15 16:52 Gemfile.lock
drwxr-xr-x  4 charles charles 4096 nov.  15 16:52 lib
drwxr-xr-x  2 charles charles 4096 nov.  15 16:53 log
-rw-r--r--  1 charles charles   68 nov.  15 16:52 package.json
drwxr-xr-x  2 charles charles 4096 nov.  15 16:52 public
-rw-r--r--  1 charles charles  227 nov.  15 16:52 Rakefile
-rw-r--r--  1 charles charles  374 nov.  15 16:52 README.md
drwxr-xr-x  9 charles charles 4096 nov.  15 16:52 test
drwxr-xr-x  2 charles charles 4096 nov.  29 10:12 tmp
drwxr-xr-x  2 charles charles 4096 nov.  15 16:52 vendor

我已经sudo chown - R charles ./ ./是我的rails目录。 我不知道问题在哪里,我的用户和目录权限似乎很好,我不会像su那样去做那些命令,因为这不是一个好习惯。

1 个答案:

答案 0 :(得分:0)

通过执行rbenv rehash

解决了问题