TeamCity 忘记了管理员密码 - 在哪里查找?

发布于 2024-07-13 06:38:55 字数 194 浏览 3 评论 0原文

我需要恢复/重置 JetBrain 的 TeamCity 的管理员密码。

我对服务器有完全的 RDP 访问权限,所以没有问题。 我们使用它才过去两个月,所以现在我忘记了我的登录信息 - 我常用的登录信息不起作用。

目前它的设置没有数据库,所以希望用户名只是在某个文件中,但到目前为止还没有找到它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

与他有关 2024-07-20 06:38:55

在 TeamCity 8 中,您可以以超级用户身份登录并以这种方式更改密码。 您只需使用空用户名和在logs\teamcity-server.log 文件中找到的最后一次出现的“超级用户身份验证令牌”作为密码。

请参阅以下内容了解更多信息:

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:

春庭雪 2024-07-20 06:38:55

如果这些都不起作用,请参阅 http://sebastienlachance.com/post/Resetting-TeamCity -密码.aspx

打开命令提示符并转到 \webapps\ROOT\WEB-INF\lib 文件夹。 现在输入以下内容:

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

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
欲拥i 2024-07-20 06:38:55

超级用户直接 URL:

http://servername:port/login.html?super=1

打开 TeamCity 日志文件夹(示例 C: 驱动器:C:\TeamCity\logs):teamcity-server.log,找到密钥:“超级用户身份验证”

[2019-03-04 12:14:30,770]   INFO -   jetbrains.buildServer.SERVER - Super user authentication token: `8347518935696887114` (use empty username with the token as the password to access the server)

Super user direct URL :

http://servername:port/login.html?super=1

Open TeamCity log folder (Example C: drive: C:\TeamCity\logs) : teamcity-server.log, find the key: “Super user authentication”

[2019-03-04 12:14:30,770]   INFO -   jetbrains.buildServer.SERVER - Super user authentication token: `8347518935696887114` (use empty username with the token as the password to access the server)
千纸鹤 2024-07-20 06:38:55

对于 TeamCity 6.5.4

从 [TeamCity 安装文件夹]\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

在我的情况下,我的用户名是“admin”(我想我在安装过程中设置了它,但我不能当然)。

我省略了 TeamCity 参数的路径,它足够聪明,可以使用正确的路径(我的路径是 c:\users\administrator.BuildServer)

当我提供 TeamCity 的(错误)路径作为参数时,我收到了此消息:

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)

如果这令人困惑其他人也是如此。

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.

山田美奈子 2024-07-20 06:38:55

您可以尝试通过删除 TeamCity 数据目录(默认情况下 $/.BuildServer 目录)来重置 TeamCity 的安装

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

幼儿园老大 2024-07-20 06:38:55

请尝试以下操作:

首先停止 TeamCity 服务(如果安装了构建代理,也会停止)。
接下来打开控制台,转到 java 目录并从那里运行以下命令:

java.exe -cp server.jar; hsqldb.jar ChangePassword USERNAME PASSWORD "PATH_TO_YOUR_TEAMCITY_INSTALLATION".BuildServer

Try the following:

First stop the TeamCity service (would also stop the build agent if installed).
Next open up a console, go to your java directory and run the following command from there:

java.exe -cp server.jar; hsqldb.jar ChangePassword USERNAME PASSWORD "PATH_TO_YOUR_TEAMCITY_INSTALLATION".BuildServer
☆獨立☆ 2024-07-20 06:38:55

我刚刚经历了 v5 EAP 的痛苦。

我成功地通过运行以下命令重置了密码:

C:\TeamCity\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 password c:\TeamCity\.BuildServer

尽管您需要将 C:\TeamCity 替换为安装所在的位置。

I've just had to go through this pain with v5 EAP.

I managed to reset the password successfully by running:

C:\TeamCity\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 password c:\TeamCity\.BuildServer

Although you'll need to substitute C:\TeamCity with wherever your installation is located.

东走西顾 2024-07-20 06:38:55

为了防止这对其他人有帮助,在我的服务器上安装 TeamCity 的人都将构建目录放置在管理员配置文件下,而不是 C:\TeamCity 中。

In case this helps someone else, whoever installed TeamCity on my server placed the build directory under the Administrator's Profile, not in C:\TeamCity.

梦萦几度 2024-07-20 06:38:55

特别是对于在 Windows 上的 Tomcat 上运行的 TeamCity,它将是 C:\ProgramData\JetBrains\TeamCity

指定为最后一个参数的目录需要是您的数据目录(在 /logs/teamcity-server.log 中查找)

您将得到 '如果您没有正确设置,则会出现“找不到表”错误。

如果您正在运行 TeamCity,您将收到“数据库已在使用中”错误。

您还可以搜索 /logs/teamcity-server.log 以查看您是否创建了 admin、administrator 或其他管理员用户名。

Specifically for TeamCity running on Tomcat on Windows it will be C:\ProgramData\JetBrains\TeamCity

The directory specified as the last parameter needs to be your Data Directory (find in /logs/teamcity-server.log)

You'll get the 'Table not found' error if you don't have this correct.

You'll get a 'The database is already in use' error if you've got TeamCity running.

you can also search you /logs/teamcity-server.log to see whether you created admin, administrator, or some other admin user name.

爱殇璃 2024-07-20 06:38:55

对于像我一样在原始答案几年后才看到这篇文章的每个人来说,有一个内置的超级用户帐户,每次启动 team city 时都会重新生成密码,并且密码位于日志中。 您可以使用此超级用户登录并重置任何密码。 这非常简单。

https://confluence.jetbrains.com/display/TCD9/Super+User

For everyone that may arrive at this article years after the original answer like I just did, there's a built-in super user account, and the password is regenerated every time team city is started, and the password is in the log. You can use this super user to login and reset any passwords. It's super easy.

https://confluence.jetbrains.com/display/TCD9/Super+User

几度春秋 2024-07-20 06:38:55

TeamCity 始终使用数据库 - 如果您没有显式配置数据库,它会使用HSQLDB数据库在内部存储数据

当使用外部数据库时,用户信息存储在该数据库中,因此您的情况下的用户信息很可能存储在 HSQLDB 系统中。

您也许可以通过处理数据库来访问系统 - 但我建议先进行备份。

第二个建议 - 给 JetBrains 的支持人员发送电子邮件。 甚至在我的工作场所花费巨资购买 TeamCity Enterprise 许可证之前,他们的支持就非常出色 - 快速、准确且乐于助人。

TeamCity always uses a database - if you haven't explicitly configured one, it uses a HSQLDB database to store data internally.

When using an external database, user information is stored within that database, so it seems pretty likely that the user information in your case will be stored within the HSQLDB system.

You might be able to gain access to the system by futzing around with the database - but I'd suggest taking a backup first.

Second suggestion - drop the support guys at JetBrains an email. Even before my workplace splashed out on a TeamCity Enterprise license, their support was superb - fast, accurate and helpful.

树深时见影 2024-07-20 06:38:55

使用 MySQL 的 TeamCity 5(可能还有其他版本和 RDBM,但未经测试),可以直接通过 SQL 更新密码:

mysql> update users set password = md5("mypass123") where username = "bob";

不过,如果没有充分的理由,我会坚持使用其他人已经提到的 CLI 版本不要这样做。

With TeamCity 5 using MySQL (probably other versions and RDBMs as well, but untested), it's possible to update the password directly via SQL:

mysql> update users set password = md5("mypass123") where username = "bob";

Nevertheless, I'd stick with the CLI versions already mentioned by others if there isn't a good reason not to do so.

箹锭⒈辈孓 2024-07-20 06:38:55

第一点是,如果您注销,登录屏幕上已填写用户名“TCAdmin”,而它应该是“管理员”。 TCAdmin 是(我认为)默认版本 5 管理员用户的全名。 将其更改为管理员,然后使用密码,我认为这解决了我的问题。

用于重置...
如果它对 TeamCity 版本 5 上的 Windows XP 上的其他人有帮助,我的 .BuildServer 配置信息也在我当前登录用户的文档和设置文件夹下。 另外,我还被 Sebastien 上面的好答案中的 jar 文件列表中的空格绊倒了。

所以我在命令提示符下更改为这个目录:

 c:\teamcity\webapps\ROOT\WEB-INF\lib 

然后这个命令行(设置密码:Password1)对我有用:

C:\TeamCity\webapps\ROOT\WEB-INF\lib>..\..\..\..\jre\bin\java.exe -cp server.jar;commonapi.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword administrator Password1

它给出了输出:

Using TeamCity configuration directory path: C:/Documents and Settings/tamw/.BuildServer 
Password changed successfuly

First point is if you logout the login screen has the username 'TCAdmin' already filled in, when it should be 'administrator'. TCAdmin is the full name of (I think) the default version 5 admin user. Changing that to administrator and then using the password I thought it was solved my issue.

For resetting...
In case it helps someone else on Windows XP on version 5 of TeamCity, my .BuildServer config info was also under my current logged in user's documents and settings folder. Also I was tripped up by a space in the list of jar files in Sebastien's good answer above.

So I changed to this directory in a command prompt:

 c:\teamcity\webapps\ROOT\WEB-INF\lib 

and then this command line (to set password: Password1) worked for me:

C:\TeamCity\webapps\ROOT\WEB-INF\lib>..\..\..\..\jre\bin\java.exe -cp server.jar;commonapi.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword administrator Password1

Which gave output:

Using TeamCity configuration directory path: C:/Documents and Settings/tamw/.BuildServer 
Password changed successfuly
风吹雨成花 2024-07-20 06:38:55
  1. 停止 teamcity
  2. 你应该将路径传递给你的构建服务器
    例如,如果您将构建服务器安装到目录“c:\.BuildServer”

........\jre\bin\java.exe -cp server.jar;common-api.jar;commons-codec-1.3.jar ;util.jar;hsqldb.jar ChangePassword 用户名 新密码 c:\.BuildServer

  1. Stop teamcity
  2. You should pass path to your buildserver
    e.g. if you installed build server to dir "c:\.BuildServer"

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

秋日私语 2024-07-20 06:38:55

更改用户密码:

关闭服务器

切换到 /webapps/ROOT/WEB-INF/lib 目录

调用以下命令:

Windows 平台:
java -cp server.jar;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword

Unix 平台:
java -cp server.jar:common-api.jar:commons-codec-1.3.jar:util.jar:hsqldb.jar ChangePassword

如果您使用 TeamCity 数据文件的默认路径,则可以跳过该选项: /.BuildServer

[参考:http://confluence.jetbrains.com/display/TCD7/Changing+user+password+with+default+authentication+scheme]

To change user password:

Shutdown server

Switch to the /webapps/ROOT/WEB-INF/lib directory

Invoke the following command:

Windows platform:
java -cp server.jar;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword

Unix platform:
java -cp server.jar:common-api.jar:commons-codec-1.3.jar:util.jar:hsqldb.jar ChangePassword

You can skip the option, if you are using default path for TeamCity data files: /.BuildServer

[Ref: http://confluence.jetbrains.com/display/TCD7/Changing+user+password+with+default+authentication+scheme]

酷遇一生 2024-07-20 06:38:55

这对我有用。

关闭服务器服务

> cd c:\TeamCity\webapps\ROOT\WEB-INF\lib>

,然后

> ..\..\..\..\jre\bin\java.exe -cp server.jar ;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword admin password1 C:\ProgramData\JetBrains\TeamCity\

如果没有最后的路径,它将失败并显示:

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.ja
va:1833)
        at org.hsqldb.jdbc.jdbcConnection.prepareStatement(jdbcConnection.java:5
80)
        at ChangePassword.main(ChangePassword.java:14)

Here's what worked for me.

Shut down server services

> cd c:\TeamCity\webapps\ROOT\WEB-INF\lib>

then

> ..\..\..\..\jre\bin\java.exe -cp server.jar ;common-api.jar;commons-codec-1.3.jar;util.jar;hsqldb.jar ChangePassword admin password1 C:\ProgramData\JetBrains\TeamCity\

Without the path at the end, it would fail with:

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.ja
va:1833)
        at org.hsqldb.jdbc.jdbcConnection.prepareStatement(jdbcConnection.java:5
80)
        at ChangePassword.main(ChangePassword.java:14)
浅紫色的梦幻 2024-07-20 06:38:55

我们使用 Teamcity 7 和 MS SQL Server 作为 RDBMS。

要重置密码,您可以使用以下查询:

UPDATE users SET password = LOWER(SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('md5','your_new_password')),3,32))
 where username = "your_user_name";

We are using Teamcity 7 with MS SQL Server as the RDBMS.

To reset your password you can use the following query:

UPDATE users SET password = LOWER(SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('md5','your_new_password')),3,32))
 where username = "your_user_name";
已下线请稍等 2024-07-20 06:38:55

或者,您可以使用 TeamCity 服务器日志并检索超级用户令牌。

使用令牌,转到 URL:http://(server):( port)/login.html?super=1

即: http://localhost: 92/login.html?super=1

登录后,您随时可以创建新用户或重置相关帐户的密码。

Alternatively, You could use the TeamCity Server Log and retrieve the Super User token.

Using the token, go to the URL : http://(server):(port)/login.html?super=1

ie: http://localhost:92/login.html?super=1

Once you logged in, you could always create a new user or reset the password for the account in question.

巷子口的你 2024-07-20 06:38:55

我在同样的情况下通过并使用超级用户登录,请按照以下步骤操作:

1 - 在路径“XX:\TeamCity\logs”中的“teamcity-server.log”中获取令牌;

2 - 使用 url 处的令牌访问和登录:“/login.html?super=1”;

更多信息:

https://confluence.jetbrains.com/display/TCD18/Super+用户

I passed in the same situation and did login with super user, follow steps below:

1 - Get Token in the "teamcity-server.log" in the path "XX:\TeamCity\logs";

2 - Access and login using token at url: "/login.html?super=1";

More about it:

https://confluence.jetbrains.com/display/TCD18/Super+User

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文