Skip to content
TeamCity RunAs plugin
Branch: master
Clone or download
Latest commit cd7ad61 Nov 11, 2011
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea project files fixes Sep 21, 2011
runas-agent fix plugin to be compatible with 6.5.3 and above Sep 21, 2011
LICENSE.txt first commit Jul 13, 2011
README fix URL Nov 11, 2011
runas.iml project files fixes Sep 21, 2011
teamcity-plugin.xml version == snapshot Sep 21, 2011


This is a RunAs plugin for JetBrains TeamCity:

With help of this plugin you can run builds under different user accounts or perform some additional actions before or after build process.


The last build of RunAs plugin can be downloaded from:

How To Build

1) Download and install TeamCity version 6.5.3 or later (
2) Download and install IntelliJ IDEA Community or Ultimate Edition (
3) Open project in IntelliJ IDEA
4) Set TEAMCITY_DISTR path variable to directory where TeamCity is installed
5) Choose Menu Build -> Build Artifacts
6) Select runas-plugin artifact from the menu
7) file must be created in the project root

How To Install

Copy to .BuildServer/plugins and restart TeamCity server. This will cause automatic agents upgrade.

How To Use

* Open <agent inst dir>/conf/ file for editing.
* Specify there additional property:
* This property has the following format:
<path to executable> <arg1> <arg2> ... <argN> {start_build_script}
where path to executable - is a path to some executable which will start the build process, the path must be quoted if it contains spaces
arg1, argN - arguments for this executable
{start_build_script} - path to a script (.cmd on Windows or .sh on Unix) generated by this plugin which contains command line to start build process

Note that if you want to run build under different user account build agent itself must be started under the privileged user.
Build agent needs to have full access to checkout directories, spawned processes (to be able to kill them), temporary files created by the build.
On Linux this means the agent must have root privileges.


* Run as different user account on Windows (psexec)"C:\\Program Files\\SysInternals\\psexec.exe" -u %runas.username% -p %runas.password% {start_build_script}

Note that in this case %runas.username% and %runas.password% will be substituted with real values provided in the build. For example, you can define values for these parameters in a TeamCity project.

* Run as different user account on Linux (sudo)<path to> %runas.username% %runas.password% {start_build_script}

chown -R $user $checkoutdir
chown -R $user $tempdir
echo $pwd | sudo -S -u $user $script


Apache License 2.0


Pavel Sher (

You can’t perform that action at this time.