I'm using Amazon Linux. I have created a jboss user, and after logging in as that user, I can see their $PATH as such
[myuser@mymachine ~]$ sudo su - jboss
[sudo] password for myuser:
Last login: Sun Nov 5 18:19:43 UTC 2017 on pts/0
...
[jboss@mymachine ~]$ which firefox
/usr/local/bin/firefox
[jboss@myuser ~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/maven/bin:/usr/java/latest/bin:/home/jboss/.local/bin:/home/jboss/bin
Notice that "firefox" is on my path. I have a Jenkins WAR file running under the user jboss and I have a script (post build step) within my Jenkins job. However, when running that script, the $PATH in Jenkins does not seem to match the jboss user ...
+ whoami
jboss
+ which firefox
which: no firefox in (/usr/local/maven/bin:/usr/java/latest/bin:/usr/java/latest/bin:/sbin:/usr/sbin:/bin:/usr/bin)
How do I get the $PATH when running Jenkins under the jboss user to match the $PATH when logged in as jboss on the terminal?