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?