title: How can I switch to the user jenkins in the middle of a ssh script?
body: <p>I run</p>
  
  <pre><code>ssh root@myhost "sh -x" &lt; myremotecommands.sh
  </code></pre>
  
  <p>where myremotecommands.sh contains:</p>
  
  <pre><code>#!/bin/sh
  sudo su
  apt-get update
  sudo su -l -p jenkins
  whoami
  </code></pre>
  
  <p>however the command whoami returns 'root'.
  I need to be user jenkins to perform some installations.</p>
  
  <p>How can I switch to the user jenkins in the middle of the script ?</p>