title: sudo inside Jenkins pipeline script
body: <p>We have the following setup:</p>
  
  <ol>
  <li>We have few UNIX boxes.</li>
  <li>There are users provisioned to these boxes (ex: <em>spande</em>).</li>
  <li>These users have limited privileges, but can do sudo to elevate the permissions (sudo user: <em>admin</em>).</li>
  <li>The sudo happens without any password.</li>
  </ol>
  
  <p>We have a CICD tool in Jenkins which uses these Unix boxes as slave. We have <em>spande</em> credentials to login into this unix servers via Jenkins. </p>
  
  <p>We are using Jenkins Pipeline Scripts (groovy). All is well, but we want the Jenkins script to run with a higher previlige and hence need to know: </p>
  
  <ol>
  <li>how can we do sudo within Jenkins script? (<em>sudo su - admin</em>)</li>
  <li>is this a best practice / good approach to sudo within a script? If not, what other alternative we have? (our Unix server team is not ready to create a password enabled user with higher privileges due to organisation policies)</li>
  </ol>
  
  <p>Any help is appreciated!!</p>