Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 757 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Don't run bundler as root" - what is the exact difference made by using root?

#1
If you run ruby bundler from the command line while logged in as root, you get the following warning:

> Don't run Bundler as root. Bundler can ask for sudo if it is needed,
> and installing your bundle as root will break this application for all
> non-root users on this machine.

What is this exact difference that running bundler as root makes to the gems it installs?

Is it to do with the permissions of the actual files that it installs for each gem? Will Ruby try to access the gem files as a non-root user (and if so, what user / group would Ruby use and how would I find out)?

What would be the symptoms of an application that is broken due to bundler being used as root?

---

My specific reason for asking is because I'm trying to use bundler on a very basic Centos VPS where I have no need to set up any non-root users. I'm [having other problems with gems installed via bundler](

[To see links please register here]

) (`Error: file to import not found or unreadable: gemname` despite the gem in question being present in `gem list`), and I'm wondering if installing the gems via bundler as root might have made the files unreadable to Ruby.

I want to work out if I do need to set up a non-root user account purely for running bundler, and if I do, what groups and privileges this user will need to allow Ruby to run the gems bundler installs.

Or can I just `chown` or `chgrp` the gem folders? If so, does it depend on anything to do with how Ruby is installed? (I used RVM and my gems end up in `/usr/local/rvm/gems/` which is owned by root in group rvm) [This loosely related question's answer implies that unspecified aspects of how Ruby is installed influence bundler's permissions requirements](

[To see links please register here]

).

Researching the "Don't run bundler as root" message only comes up with [an unanswered question][1] and [complaints that this warning is apparently "like it saying to go to sleep at 8PM" (link contains NSFW language)][2].


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#2
So I had to dig into the git log history of bundler's repo, because GitHub [doesn't allow search][1] in git commits messages anymore.

The commit `c1b3fd165b2ec97fb254a76eaa3900bc4857a357` says :

> Print warning when bundler is run by root. When a user runs bundle install with sudo bundler will print a warning, letting
> them know of potential consequences.
>
> closes [#2936][2]
>

Reading this issue, you understand the real reason you should not use the `root` user:

> Running sudo bundle install can cause huge and cascading problems for
> users trying to install gems on OS X into the system gems. We should
> print a warning and explain that Bundler will prompt for sudo if it's
> needed. We should also warn people that sudo bundle will break git
> gems, because they have to be writable by the user that Bundler runs
> as.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through