背景:
我有一个每天都在新部署的应用程序--创建一个VM,然后该系统的根创建一个"systemuser",然后安装这个应用程序。
它正在运行:
按照设置的方式,我必须让Rails自己安装,并安装乘客。为此,运行该服务的用户具有sudo权限,但其意图是只允许安装期间所需的命令。出于安全性和可维护性的原因,我们不能在脚本中输入sudo密码。
我/etc/sudoers包括:
systemuser ALL = NOPASSWD: /usr/bin/env, /bin/bash, /usr/local/rvm/rubies/ruby-1.8.7-p358/bin/gem, /bin/cp, /bin/ln, /bin/mv, /bin/rm, /etc/init.d/httpd *问题是:
直到最近,它的一个变体还发挥了很大的作用。但是最近在某个地方发生了变化(?)并且rvmsudo命令不再在没有密码提示的情况下执行。
$ rvmsudo passenger-install-apache2-module
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for systemuser: 问题是:
在/etc/sudoers中安装rvm、ruby、bundler/gem以及然后在apache上安装passenger2的最小命令集是什么?
是的,我在https://rvm.io/integration/passenger/读过“文档”
欢迎创意解决方案!我意识到有人可能会说这看起来像一个非常讨厌的系统,我同意你的观点。但是目前,如果不了解这个乘客安装脚本运行的是什么命令,我很难对其进行改进。
从前面删除"env“和"bash”,并添加"rvm“,会得到更多的信息:
systemuser ALL = NOPASSWD: /usr/local/rvm/bin/rvmsudo, /usr/local/rvm/gems/ruby-1.8.7-p358/bin/passenger-install-apache2-module, /bin/cp, /bin/ln, /bin/mv, /bin/rm, /etc/init.d/httpd *运行此命令:
$ rvmsudo passenger-install-apache2-module
[sudo] password for systemuser: 感谢您的关注!
发布于 2012-12-17 23:21:32
/usr/bin/env是一个路由器,允许运行任何命令,与/bin/bash一样,您必须添加which passenger-install-apache2-module而不是它们。
https://stackoverflow.com/questions/13923611
复制相似问题