Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cap invoke and sudo

I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command?

In other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command line.

like image 848
danpickett Avatar asked Sep 24 '08 18:09

danpickett


2 Answers

Found it - cap invoke COMMAND="command that requires sudo" SUDO=1

like image 115
danpickett Avatar answered Sep 22 '22 00:09

danpickett


I'm not quite sure I understand the question, but I think you're asking how to restrict sudo to the one specific command and not have to grant unlimited capacity for mischief to all of your Ruby developers.

/etc/sudoers can be set up to restrict the commands which users are allowed to invoke as root. It is commonly set to ALL, but you can provide just a list of the allowed commands.

like image 45
DGentry Avatar answered Sep 20 '22 00:09

DGentry