title: Jenkins switch user and execute command
body: <p>I am trying to switch user in my Jenkinsfile and then run a command. Running it on the Linux box this command does work, however when running it in Jenkins I get the following error:</p>
  
  <pre><code>su: unrecognized option '--stop'
  Try `su --help' for more information.
  </code></pre>
  
  <p>The command I wish to execute:</p>
  
  <pre><code>su - testuser -c 'testcontrol --stop --app testfeed --no_prompt_on_change'
  </code></pre>
  
  <p>My Jenkinsfile:</p>
  
  <pre><code>node {
    echo 'Stopping Feed'
    CHEF_SERVER = sh (script: 'grep chef_server_url /etc/chef/client.rb | awk -F\'/\' \'{print $3}\'', returnStdout: true).trim()
    TARGET_SERVER = "foo"
    stage('Switching userstopping process') {
      try {
          echo sh(script: "ssh ${CHEF_SERVER} salt ${TARGET_SERVER} cmd.run \\'su - testuser -c 'testcontrol --stop --app testfeed --no_prompt_on_change'\\'", returnStdout: true)
      }
      catch (e) {
          // catch error code here
      }
    }
  }
  </code></pre>