We use thin clients at our company and we have many users using the same box. I've installed rbenv as a system install by following the instructions on the following website;
https://blakewilliams.me/posts/system-wide-rbenv-install
This boils down to these commands
cd /usr/local
git clone git://github.com/sstephenson/rbenv.git rbenv
chgrp -R staff rbenv
chmod -R g+rwxXs rbenv
By running the last line there we should be able to install gems as any user of the system which is part of the 'staff' group. We have two developers which are part of that group and neither can install gems.
We get the error;
~ % gem install cheat
/usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/config_file.rb:332:in `exist?': Insecure operation - exist? (SecurityError)
from /usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/config_file.rb:332:in `load_file'
from /usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/config_file.rb:198:in `initialize'
from /usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/gem_runner.rb:75:in `new'
from /usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/gem_runner.rb:75:in `do_configuration'
from /usr/local/rbenv/versions/2.3.5/lib/ruby/2.3.0/rubygems/gem_runner.rb:40:in `run'
from /usr/local/rbenv/versions/2.3.5/bin/gem:21:in `<main>'
~ % gem install cheat
If I remove the sticky bit from the group then they can add gems but if someone tries to remove a gem installed by someone else this will fail;
~ % chmod -R g-s rbenv
How do I allow multiple users install/uninstall gems from a system wide installation of rbenv?
Update
Here is an example of installations in the /usr/local/rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems
directory, as you can see
drwxrwxr-x 5 map7 map7 4.0K Jun 4 15:50 unicode-display_width-1.3.3
drwxrwxr-x 5 andre andre 4.0K May 23 13:22 vcr-3.0.3
drwxrwxr-x 3 map7 staff 4.0K Apr 30 11:01 web-console-3.6.2
The solution to this I found as
: cd /usr/local/rbenv/versions/2.5.1/lib/ruby/gems/2.5.0
: sudo chown -R map7:staff gems
: sudo chmod -R 775 gems
: sudo chmod g+s gems