Teamcity NTLM Authentication change - admin user lost in transition
I've switched in teamcity from using basic authentication to using NTLM, on an existing installation.
This works fine, except that the admin user didn't have a corresponding NT account, and so doesn't work on the NTLM configuration. (It is easy to roll back, so it is not a stress).
My question is - what is the command to set a user to admin manually - ie modifying the database?
(like this: TeamCity forgotten admin password - where to开发者_运维知识库 look?) but changing the role of a user to global system administrator.
Edit - we're using HSQLDB.
Turns out this is the process:
- Log onto the teamcity server
- Stop teamcity web server and build server services on this machine
- From the teamcity prefs directory
...\TeamcityPrefs\system
run the following commandjava -cp ...\TeamCity\webapps\ROOT\WEB-INF\lib\hsqldb.jar org.hsqldb.util.DatabaseManager
- Set the connection url to
"jdbc:hsqldb:file:buildServer"
with username"SA"
and password""
- Get the userid of the user you want to update:
select * from users u where u.username = 'myuser'
- Insert an admin role for that user:
insert into user_roles (user_id, role_id) values (42, 'SYSTEM_ADMIN')
- Close the HSQLDB manager
- Start teamcity
Running HSQLDB Database Manager requires an X display - it's actually a lot quicker and simpler to use SqlTool instead:
Create an sqltool.rc in the home directory of the user running TeamCity
urlid teamcity
url jdbc:hsqldb:file:buildserver
username sa
passwordin your TeamCity datadirectory, cd to system and run:
java -cp PATH-TO/webapps/TeamCity-6.5.5/WEB-INF/lib/hsqldb.jar org.hsqldb.util.SqlTool teamcity
At the SQL prompt, run the remdial action above given by hawkeye.
Remember to commit after making your changes
You could try this from the TeamCity documentation but it may not work with NTLM.
What database are you using for the TeamCity installation? If you're using the SQL Server backend then you can look in the user_roles table, you would need to set the role_id to SYSTEM_ADMIN with a NULL for project id and find the user_id from the users table (the user will need to have logged into TeamCity). The approach would be similar for other storage backends but it may be easier to simply restart.
精彩评论