you could do something along the line of su testuser -c 'command to run as testuser'
From: [email protected] [[email protected]] on behalf of Amit Chettri [[email protected]] Sent: Wednesday, October 07, 2020 9:24 PM To: Jenkins Users Subject: Run jenkins jobs as different user or switch user during the execution 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 Last login: Thu Oct 8 00:35:26 IST 2020 + whoami 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/38B822B13B092D4C832A97382607EFDF07CFA3AD%40ERDE.irisgmbh.local.
