Barth
Barth

Reputation: 15715

how to run a job on the master as a different user?

I have jenkins installed on a linux machine within tomcat behind Apache. As a consequence jenkins runs as tomcat. The user tomcat is not configured properly to run the job.

How do I tell Jenkins to run a job as a different user on the same machine ?

Does it make sense to define a slave on the same machine but with a different user ?

Upvotes: 2

Views: 1387

Answers (2)

user2299648
user2299648

Reputation: 1

I sometimes would ssh into the account and instead of running build.sh run ssh user@localhost build.sh

Upvotes: 0

Lars Kotthoff
Lars Kotthoff

Reputation: 109232

You can use su or sudo to run as a different user inside a build step, but that comes with some security implications. If this is something you want to do regularly I would recommend that you define a slave on the same machine with the other user, as you have suggested. I am not aware of any plugins/extensions that would make this easier for you unfortunately.

Upvotes: 4

Related Questions