Search code examples
ruby-on-railssudo

rails s - Permission denied


I've created a rails app but I'm not enabled to do a rails server or rake routes, error is : /home/charles/.rbenv/shims/rails: ligne 21: /root/.rbenv/libexec/rbenv: Permission non accordée

Going su works but it's not good to do this that way.

With visudo I have this, my current user charles has user privilege : #

# 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 output this :

➜  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

I've made sudo chown - R charles ./ where ./ is my rails directory. I don't known where the problem is my user and directory rights seems good and I don't to go as su to do those commands as it is not a good practice.


Solution

  • Resolved the problem by doing rbenv rehash