Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set up automatic deployment for my Rails app using Capistrano. Capistrano will need to run sudo kill, and I achieved that without it asking me for a password, by editing the /etc/sudoers file (via visudo, of course), and added the following line:

%deployers  ALL= NOPASSWD: /bin/kill

However, since I am using RVM single-user setup, the bundle executable is at /home/peddiemarketdeploy/.rvm/gems/ruby-1.9.3-p194/bin/bundle, so, similarly, I added

%deployers  ALL= NOPASSWD: /home/peddiemarketdeploy/.rvm/gems/*

in that file as well, and tried to run sudo bundle, but sudo still asks me for a password. Since RVM uses version number in the name of directories, I do not want to hardcode a path into /etc/sudoers. Any ideas how I can edit my sudoers file to make it work?


share|improve this question
up vote 0 down vote accepted

Does rvm somehow link to the active ruby instance? That is, is there some sort of symlink called /home/peddiemarketdeploy/.rvm/gems/$active that points to whatever the active version happens to be? If so, then allow sudo for /home/peddiemarketdeploy/.rvm/gems/$active/bin/bundle. Otherwise write a wrapper script (not in shell, but perl or python) that picks the right version and allow people to run that using sudo.

share|improve this answer
No but I guess creating one myself would work for me :) – jiehanzheng Aug 24 '12 at 8:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.