Hello,

I have a requirement where I need to switch user in between in the pipeline 
run
:
:
steps
      {
        script
        {
       
            sh """
              sudo su - testuser
              whoami
            """
    :
    : 
    :
    }
 }

but during the pipeline run user is not switch and its still the jenkins 
user

+ sudo su - testuser

<http://192.168.4.25:8080/blue/organizations/jenkins/windows-patch-management-all-patches/detail/windows-patch-management-all-patches/38/pipeline#step-25-log-2>Last
 
login: Thu Oct 8 00:35:26 IST 2020 

<http://192.168.4.25:8080/blue/organizations/jenkins/windows-patch-management-all-patches/detail/windows-patch-management-all-patches/38/pipeline#step-25-log-3>+
 
whoami 

<http://192.168.4.25:8080/blue/organizations/jenkins/windows-patch-management-all-patches/detail/windows-patch-management-all-patches/38/pipeline#step-25-log-4>
jenkins

*how can I run the job as a different user or switch user to testuser 
without making any change to **$ sudo vim /etc/sysconfig/jenkins  *

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f40da188-c4c2-4bf3-99a3-134ca4f65180n%40googlegroups.com.

Reply via email to