Run shell scripts on Jenkins as super user [sudo] without given too much privileges

You have a Jenkins build server and want to run a script which requires super user rights. But you do not want do make your jenkins user a super user.

With the following you give your jenkins user only sudo rights for a specific script.

In the /etc/sudoers file you can give sudo rights for a specific file to the user with which you run jenkins.
Schermafbeelding 2014-12-02 om 19.48.27

Then in your Jenkins job, you can sudo this script
Schermafbeelding 2014-12-02 om 19.48.46