1

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?

Thanks!

jiehanzheng
  • 113
  • 3

1 Answers1

0

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.

ptman
  • 27,124
  • 2
  • 26
  • 45