为什么我不应该 运行 bundle install as root?
Why shouldn't I run bundle install as root?
我在玩 bundler,当 运行 bundle install
具有 root 权限时注意到警告:
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.
这是为什么?
有两件事相互影响,使得以 root 身份安装大多数软件 "bad idea":
- 大多数创建文件的程序默认以 运行 程序的用户身份创建文件。
- root 创建的文件通常不会授予其他任何人 read/write/execute 权限。
在使用 Bundler 以 root 身份安装包的情况下,这意味着您安装的 ruby gem 中的脚本将无法被任何其他用户访问。
我在玩 bundler,当 运行 bundle install
具有 root 权限时注意到警告:
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.
这是为什么?
有两件事相互影响,使得以 root 身份安装大多数软件 "bad idea":
- 大多数创建文件的程序默认以 运行 程序的用户身份创建文件。
- root 创建的文件通常不会授予其他任何人 read/write/execute 权限。
在使用 Bundler 以 root 身份安装包的情况下,这意味着您安装的 ruby gem 中的脚本将无法被任何其他用户访问。