Permission Denied in rvm update and rvm remove - ruby-on-rails

There is rvm 1.19.6 installed on ubuntu 12.04 with ruby 2.0.0. Just receive permission denied when doing rvm get stable. Here is the error:
$rvm get stable
######################################################################## 100.0%
bash: line 535: /home/ubuntu/.rvm/RELEASE: Permission denied
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
When we are trying to installing readline on the server, the rvm remove 2.0.0 creates the permission deny error:
$rvm remove 2.0.0
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
Removing /home/ubuntu/.rvm/src/ruby-2.0.0-p0...........
.........
Error running '__rvm_rm_rf /home/ubuntu/.rvm/rubies/ruby-2.0.0-p0',
please read /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720907_remove.rubies.log
rm: cannot remove `/home/ubuntu/.rvm/bin/ruby-2.0.0-p0': Permission denied
Removing ruby-2.0.0-p0 aliases...
Removing ruby-2.0.0-p0 wrappers...
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/ruby': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/rake': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/erb': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/gem': Permission denied
We tried to delete ~/.gem/ and assign the right to ~/.gem/specs following this post, it did not work. What's wrong with the rvm? Thanks for help.

pulling from comments.
rvm was installed as root, and needs to be owned by the ubuntu user (or you need to run all commands as root)
sudo chown -R ubuntu .rvm will fix the permissions errors
as for the ruby 2.0.0#global it doesn't need to be removed. if you look at the rvm documents that is used as a place to install gems that should be across all gemsets for that particular version of ruby for instance I have bond, hirb, wirb, awesomeprint all in my global as they are referenced in my .irbrc. So as I create per project gemsets I always have them available to me (things like bundler are also handy there)

Related

Permission denied in homebrew

I'm trying to utilize the msmtp package downloaded from homebrew.
I also setup my .mailrc file pointing at the msmtp bin as specified in the instructions
set sendmail="/opt/homebrew/Cellar/msmtp/1.8.22/bin"
Then I receive the following error:
mail: /opt/homebrew/Cellar/msmtp/1.8.22/bin: Permission denied
I found a permissions solution here: How to fix homebrew permissions?
where I changed the permission for brew paths but this did not work for me
sudo chown -R $(whoami) $(brew --prefix)/*
Is there any other way I should be changing permissions?

rbenv Permission denied with Assetic on Ubuntu

I struggled for hours trying to have Assetic with Sass and Compass working on my production server.
The error is:
sh: 1: /root/.rbenv/shims/ruby: Permission denied
This is because my rbenv instalation is under the /root directory so Assetic doesn't have the permision to use it.
I've checked similar issues:
"Rbenv permission denied issue"
"rbenv: Permission Denied"
"Should rbenv be installed system-wide, or at a user level?"
but they didn't help.
I'm using Apache so I guess the default user is "www-data".
As explained in one of the above questions, I tried to grant www-data the permission in /root but either this didn't work or I did it wrong.
sudo chown -R www-data ~/.rbenv
This is the complete error:
[exception] 500 | Internal Server Error | Assetic\Exception\FilterException
[message] An error occurred while running:
'/root/.rbenv/shims/ruby' '/usr/local/bin/compass' 'compile' '/var/www/myapp/app/cache/dev' '--boring' '--images-dir' '/var/www/myapp/app/../web/uploads/img' '--config' '/var/www/myapp/app/cache/dev/assetic_compassu3IAzJ' '--sass-dir' '' '--css-dir' '' '/var/www/formation-hero/app/cache/dev/assetic_compassPbwM3H.scss'
Error Output:
sh: 1: /root/.rbenv/shims/ruby: Permission denied
I'm using Apache on Ubuntu 14.04
# which ruby
/root/.rbenv/shims/ruby
# which compass
/usr/local/bin/compass
# which rbenv
/root/.rbenv/bin/rbenv
# rbenv -v
rbenv 1.0.0-14-gc388331
Symfony 2.7 is installed under /var/www/myapp/
What should I do to either give right to Apache to use the /root repository or, maybe better, how do I install rbenv for my Symfony2 project?
Everything is working fine on my localhost with OS X.
I do not have experience with the said components but assuming that the user who is executing the file is www-data it might be an issue with the permissions of the /root/.rbend/shims/ruby file.
Run the command sudo chmod o+x /root/.rbenv/shims/ruby wich will give execute permissions to the owner of the file, presumably www-data since you ran the chown command.
If it still doesn't work run the command ls -l /root/.rbenv/shims/ruby, the 4th character of the first column should be x, indicating the owner has execution permissions.
For more info on linux file permissions check "Understanding and Using File Permissions".

I can't install gems with rvm

I'm new to ruby version manager and when i tried to install rails after installing it, I get this error . I tried to search other SO questions as well but didn't want to re-install ruby version manager. Even though when I try sudo for installation, it doesn't work.
The error I get is as follows:"ERROR: While executing gem ... (Errno::EACCES)Permission denied # dir_s_mkdir - /home/sunil/.gem/specs"
I would do this:
ls -ld /home/sunil/.gem/specs to check that folder permissions.
whoami to compare current user with /home/sunil/.gem/specs permissions
Maybe chown -R sunil:sunil ~/.gem to change owner in case .gem directory is not owned by sunil.
Maybe chmod -R u+rwX,go+rX,go-w ~/.gem to change permissions.

Rvm ruby Permission denied

I have installed rvm for multiuser,
when I am doing bundle install, it is giving me error,
linux:/var/rails_apps$ bundle install
ERROR: RVM Ruby not used, run `rvm use ruby` first.
linux:/var/rails_apps$ rvm use ruby
mkdir: cannot create directory `/usr/local/rvm/log/ruby-2.0.0-p247': Permission denied
I already did,
sudo chmod 777 /var/rails_apps/
Please suggest..
You have a multiuser installation of rvm - this is not recommended because of the troubles you can get with it (like yours).
Since you are already there this should fix it:
rvmsudo rvm get stable --auto-dotfiles
rvm fix-permissions system
Also make sure you are in rvm group - if not add yourself:
rvm group add rvm $USER
and log in to a new shell (log out and log back in).
In most of the cases rvm fix-permissions will resolve the problem for single user access but it fails in some cases while making other rvm commands thereafter. So do it with rvmsudo after the fix-permissions command consecutively as
rvm fix-permissions
rvmsudo rvm use ruby
For those who may have issues after running the commands shared on every thread out there, try opening ubuntu or the Linux environment you are working with as an administrator.
1 - Search for your app (in my case Ubuntu) using the search bar on the bottom-left of your computer's screen.
2 - if you don't see the option "open as administrator" on the right side, then right-click over the app's icon and you should see it then.
3 - Allow the app to make changes on your computer when prompted and then try the installation commands again.
4 - If that didn't work then try the commands shared in this or other posts, but always as administrator.

rvm doesn't install in centos without root privileges

I trying to install RVM using deployer user that doesn't had root privileges ant I getting
this error:
bash: line 439: ./scripts/install: Permission denied
Any help?
Thank you!
I was trying to install rvm in folder mounted with noexec option.
Mounting partition without this option works!

Resources