3

I'm trying to write, in essence, an automatic deployment script for use by our development team and I know I can set up SSH to use keys so that I can automatically authenticate via key instead of password for the purposes of executing remote commands; however, what I'm stuck on is that the task that needs to execute for deployment requires us to restart an upstart job which requires root privileges. I've looked around on the internet (and here) and have been mostly unsuccessful and finding solutions.

The question: Is there a way to remotely (and automatically, the script is not monitored so password authentication as sudo requires will not work) elevate to root privileges to restart a job or give a user group the ability to do that?

6

You can enable password-less sudo for a specific command.

# /etc/sudoers (edit with visudo)
# For a specific user/command combo
izuriel ALL=NOPASSWD:/bin/true
# For a specific command, any user in group sudo.
%sudo ALL=NOPASSWD:/bin/true
  • @donothingsuccessfully I've been away from the computer, but the network imposes a time limit before this can be done (across their different boards). It was my intention since I read the post to mark it though. – izuriel Nov 1 '12 at 19:51
1

You can do sudo w/o password; just prepend the command with NOPASSWD: in the sudoers file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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