Running TeamCity linux build agent as specific user

I am trying to set a TeamCity v6.5 build agent to run as a specific user on Ubuntu 12.04. I've tried setting up both an Upstart and and Init.d config to execute agent.sh as the user.

The process starts up and shows up as running as the user in the system process list. But when I try to execute builds on the agent it's running as what I assume is root. My github keys, rvm gemset setup for the specific user fails to work properly.

If I log in to the machine as the specific user as execute agent.sh manually, the build agent works properly and has access to everything it needs in the user's account setup.

How should I go about daemonizing the agent script and run it as a specific user?

1 comment
Comment actions Permalink

Hi Dave,

That happens because init script started from root account and TeamCity agent also started from root.

You can try attached init script (with changing user).
You just need scpecify your own pavalues for USERNAME, GROUP, AGENT_HOME parameters.

Hope this will be useful. =)



Attachment(s):
teamcity-agent.zip
0

Please sign in to leave a comment.