Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

Overall I would still consider myself a newbie Linux user, I haven't done a lot of work with permissions but I've learned my way around operations pretty well.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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
share|improve this answer
    
Thanks for the response! Very informative. –  izuriel Nov 1 '12 at 18:49
    
@izuriel: Perhaps you would like to mark anonfunc's answer as the accepted answer? –  donothingsuccessfully Nov 1 '12 at 19:45
    
@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
add comment

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

share|improve this answer
    
Thanks for the quick response! –  izuriel Nov 1 '12 at 18:49
add comment

Your Answer

 
discard

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.