Why does the TeamCity command line runner execute under “System”?

拥有回忆 提交于 2020-01-01 14:52:10

问题


I've got a bit of an auth problem with with TeamCity when running a command line build. It's related to an existing question about executing an svn checkout command but I want to ask it explicitly here:

Why is it that when the TeamCity build agent service is configured to run under a specific Active Directory account and not the local system account, when I execute this command:

echo "%username%"

I get this build output:

[20:52:04]: C:\TeamCity\buildAgent\work\b67560ceb299718c>echo "SYSTEM" 
[20:52:04]: "SYSTEM"

This is really playing havoc with my attempts to execute commands under the identity of my AD service account, why is this happening? Other build runners (i.e. MSBuild) are executing under the identity of the service account, why is this not happening for the command line?

Update 1: Wrapping the command in an MSBuild script with an Exec target does the same thing - current user is still "System".

Update 2: The output of a "set" command is showing the username as "System" but the user profile points to that of the service account:

[13:38:28]: USERDNSDOMAIN=[domain.dns name]
[13:38:28]: USERDOMAIN=[domain]
[13:38:28]: USERNAME=SYSTEM
[13:38:28]: USERPROFILE=C:\Users\[service account]

回答1:


Have you tried restarting the service after you changed the credentials? I mean both the teamcity server and the build agent



来源:https://stackoverflow.com/questions/4448680/why-does-the-teamcity-command-line-runner-execute-under-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!