title: Jenkins console execute shell running as root user instead of jenkins user
body: <p>my jenkins test job console execute shell look like this;</p>
  
  <pre><code>#!/bin/bash
  echo $(id)
  npm -v
  </code></pre>
  
  <p>when I build this job the console output shown as;</p>
  
  <pre><code>uid=497(jenkins) gid=495(jenkins) groups=495(jenkins)
  3.10.10
  </code></pre>
  
  <p>when I ssh into jenkins ec2 machine and then switch to jenkins user and run the command npm -v I got the different version of npm.
  I suspect jenkins console execute shell run as root user shell where it picked up the npm version of root user.</p>
  
  <p>when I run <code>whoami</code> and <code>which npm</code> I got the results on jenkins console as <code>jenkins</code> and <code>/usr/bin/npm</code> respectively, but while on jenkins ec2 instance when I run these commands on jenkins user shell I got the results as <code>jenkins</code> and <code>~/.nvm/versions/node/v8.10.0/bin/npm</code>. please assist me to understand why I got two different results</p>
  
  <p>Please assist. I appreciate your time</p>