TeamCity forgotten admin password - where to look?

I need to recover/reset the admin password for JetBrain's TeamCity.

I have full RDP access to the server so no problems there. It's just been 2 months since we used it so now I have forgotten my login - my usual ones don't work.

It is setup without a database at the moment, so was hoping the usernames would just be in a file somewhere, but no luck finding it so far.


Solution 1:

From TeamCity 8 you can log in as a super user and change the password that way. You just need to use an empty username and last occurrence of the "super user authentication token" found in the logs\teamcity-server.log file as your password.

Please see the following for more information:

  • TeamCity 8 - http://confluence.jetbrains.com/display/TCD8/Super+User
  • TeamCity 9 - http://confluence.jetbrains.com/display/TCD9/Super+User
  • TeamCity 10 - https://confluence.jetbrains.com/display/TCD10/Super+User

Solution 2:

In case none of those works, see http://sebastienlachance.com/post/Resetting-TeamCity-Password.aspx.

Open a command prompt and go to \webapps\ROOT\WEB-INF\lib folder. Now type the following :

..\..\..\..\jre\bin\java.exe -cp server.jar;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword username newpassword

Solution 3:

For TeamCity 6.5.4

From a command prompt in the [TeamCity install folder]\webapps\ROOT\WEB-INF\lib:

..\..\..\..\jre\bin\java -cp server.jar;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword admin NewPassword

My username was 'admin' in my case (I think I set it during installation but I can't be sure).

I ommitted the path to TeamCity argument, it's smart enough to use the correct path (mine was c:\users\administrator.BuildServer)

When I provided the (wrong) path to TeamCity as an argument I received this message:

Using TeamCity configuration directory path: c:/TeamCity/.BuildServer
Exception in thread "main" java.sql.SQLException: Table not found in statement [UPDATE users SET PASSWORD = ? WHERE USERNAME = ? AND REALM IS NULL]
    at org.hsqldb.jdbc.Util.throwError(Util.java:58)
    at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(jdbcPreparedStatement.java:1833)
    at org.hsqldb.jdbc.jdbcConnection.prepareStatement(jdbcConnection.java:580)
    at ChangePassword.main(ChangePassword.java:14)

In case this confuses other people too.

Solution 4:

You could try to reset the installation of TeamCity, by removing TeamCity data directory ($/.BuildServer directory by default)