Java Tomcat 的默认用户名和密码是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3829513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 05:35:12  来源:igfitidea点击:

What is the default username and password in Tomcat?

javatomcatnetbeans

提问by m88

I installed Netbeans and tryed to access the server's manager using: (id/pass)manager/manager, admin/admin, system/password... None of them worked.

我安装了 Netbeans 并尝试使用以下方法访问服务器的管理器:(id/pass)manager/manager、admin/admin、system/password……它们都不起作用。

采纳答案by Tushar Joshi

My answer is tested on Windows 7with installation of NetBeans IDE 6.9.1which has bundled Tomcat version 6.0.26. The instruction may work with other tomcat versions according to my opinion.

我的答案是在Windows 7上测试的,安装了NetBeans IDE 6.9.1,它捆绑了 Tomcat 版本 6.0.26。根据我的意见,该指令可能适用于其他 tomcat 版本。

If you are starting the Apache Tomcatserver from the Servers panel in NetBeans IDE then you shall know that the Catalina base and config files used by NetBeans IDE to start the Tomcat server are kept at a different location.

如果您从 NetBeans IDE 中的“服务器”面板启动Apache Tomcat服务器,那么您应该知道 NetBeans IDE 用于启动 Tomcat 服务器的 Catalina 基本文件和配置文件保存在不同的位置。

Steps to know the catalina base directory for your installation:

了解安装的 catalina 基本目录的步骤:

  1. Right click on the Apache Tomcatnode in Servers panel and choose properties option in the context menu. This will open a dialog box named Servers.
  2. Check the directory name of the field Catalina Base, this is that directory where the current conf/tomcat-users.xmlis located and which you want to open and read.
    (In my case it is C:\Users\Tushar Joshi\.netbeans\6.9\apache-tomcat-6.0.26_base)
  3. Open this directory in My Computerand go to the conf directory where you will find the actual tomcat-users.xmlfile used by NetBeans IDE. NetBeans IDE comes configured with one default password with username="ide"and some random password, you may change this username and password if you want or use it for your login also
  4. This dialog box also have username and password field which are populated with these default username and password and NetBeans IDEalso offers you to open the manager application by right clicking on the manager node under the Apache Tomcatnode in Servers panel
  5. The only problem with the NetBeans IDEis it tries to open the URL http://localhost:8084/manager/which shall be http://localhost:8084/manager/htmlnow
  1. 右键单击服务器面板中的Apache Tomcat节点,然后在上下文菜单中选择属性选项。这将打开一个名为 Servers 的对话框。
  2. 检查字段Catalina Base的目录名称,这是当前所在的目录conf/tomcat-users.xml以及您要打开和阅读的目录。
    (在我的情况下是C:\Users\Tushar Joshi\.netbeans\6.9\apache-tomcat-6.0.26_base
  3. 打开此目录My Computer并转到 conf 目录,您将在其中找到tomcat-users.xmlNetBeans IDE 使用的实际文件。NetBeans IDE 配置了一个默认密码username="ide"和一些随机密码,您可以根据需要更改此用户名和密码,也可以将其用于登录
  4. 此对话框还有用户名和密码字段,其中填充了这些默认用户名和密码,NetBeans IDE还允许您通过右键单击服务器面板中Apache Tomcat节点下的管理器节点来打开管理器应用程序
  5. NetBeans IDE的唯一问题是它试图打开现在http://localhost:8084/manager/应该是的 URLhttp://localhost:8084/manager/html

回答by Bozho

Look in your conf/tomcat-users.xml. If there is nothing there, you'd have to configure it.

看看你的conf/tomcat-users.xml. 如果那里什么都没有,则必须对其进行配置。

回答by CristiC

Check the file in <TOMCAT_HOME>/confnamed tomcat-users.xml.
If you don't find something there edit to look something like:

检查<TOMCAT_HOME>/conf名为tomcat-users.xml.
如果你在那里没有找到一些东西,编辑看起来像:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="admin"/>
  <user username="admin" password="password" roles="standard,manager,admin"/>
</tomcat-users>

回答by Buhake Sindi

In Tomcat 7, under TOMCAT_HOME/conf/tomcat_users.xml, see the <user />tag to see password.

在 Tomcat 7 下TOMCAT_HOME/conf/tomcat_users.xml,查看<user />标签以查看密码。

Example:

例子:

  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

回答by Mick Sear

Well, you need to look at the answers above, but you'll find that the manager app requires you to have a user with the role 'manager', I believe, so you'll probably want to add the following to your tomcat-users.xml file:

好吧,您需要查看上面的答案,但是您会发现管理器应用程序要求您拥有一个角色为“管理器”的用户,我相信,因此您可能希望将以下内容添加到您的 tomcat- users.xml 文件:

<role rolename="manager"/>
<user username="youruser" password="yourpass" roles="manager"/>

This might seem simplistic, but it's just a simple implementation that you can extend / replace with other authentication mechanisms.

这可能看起来很简单,但它只是一个简单的实现,您可以用其他身份验证机制扩展/替换。

回答by msangel

in file /conf/tomcat-users.xml check or add:

在文件 /conf/tomcat-users.xml 检查或添加:

......
<role rolename="manager"/>
<user username="ide" password="ide" roles="manager,tomcat,manager-script"/>
</tomcat-users>

回答by Irshad

Open tomcat-users.xmlwhich should be in C:\Tomcat 7.0\conf

打开 tomcat-users.xml哪个应该在C:\Tomcat 7.0\conf

Add following lines in above file :

在上面的文件中添加以下几行:

<tomcat-users>
     <role rolename="manager-gui"/>
     <user username="admin" password="" roles="manager-gui"/>

     <role rolename="admin-gui"/>
     <user username="tomcat" password="s3cret" roles="admin-gui"/>        
 </tomcat-users>

Note :

笔记 :

  1. admin-gui-> Username & Password - Do not Change.
  2. manager-gui-> you can change user name & password for this only. [Here password is not given]
  1. admin-gui-> 用户名和密码 - 不要更改。
  2. manager-gui-> 您只能为此更改用户名和密码。【这里没有给出密码】

回答by Darryl

If people still have problems after adding/modifying the tomcat-users.xml file and adding the relevant user/role for the version of Tomcat that they're using then please be sure that you've removed the comment tags that are surrounding this block. They will look like this in the XML file:
<!--
-->
They will be above and below the user/role section.

如果人们在添加/修改 tomcat-users.xml 文件并为他们正在使用的 Tomcat 版本添加相关用户/角色后仍有问题,请确保您已删除围绕此块的注释标签. 它们在 XML 文件
<!--
-->
中将如下所示:它们将位于用户/角色部分的上方和下方。

回答by purushottam mishra

If your apache tomcat asking for password,then just follow these steps: go to the home directory of apache then go to webapps folder open the META-INF inside that you will find an xml file named context.xml--open it in edit mode

如果您的 apache tomcat 要求输入密码,那么只需按照以下步骤操作:转到 apache 的主目录,然后转到 webapps 文件夹,打开里面的 META-INF,您将找到一个名为 context.xml 的 xml 文件--在编辑模式下打开它

and REMOVE THE COMMENT FROM the VALVE tag.

从 VALVE 标签中删除注释

After that you dont need any user name and password.

之后您不需要任何用户名和密码。

回答by Steve Kritzer

Platform NetBeans 7.3, Apache Tomcat 7.0.34 re: Tomcat Manager

平台 NetBeans 7.3、Apache Tomcat 7.0.34 回复:Tomcat 管理器

I spent 3 days tracking this down because I thought I had a bad install.

我花了 3 天的时间来跟踪这个问题,因为我认为我的安装不正确。

On Windows and Linux, NetBeans uses a separate file location for CATALINA_BASE:

在 Windows 和 Linux 上,NetBeans 为 CATALINA_BASE 使用单独的文件位置:

http://wiki.netbeans.org/FaqInstallationDefaultTomcatPassword

http://wiki.netbeans.org/FaqInstallationDefaultTomcatPassword

So you can modify the tomcat_user.xml under CATALINA_HOME: until your face turns blue, to no effect.

所以你可以修改CATALINA_HOME下的tomcat_user.xml:直到你的脸变蓝,没有效果。

It appears that the IDE only requires, manager-script,admin roles under CATALINA_BASE:.

IDE 似乎只需要 CATALINA_BASE: 下的 manager-script,admin 角色。

When I tried to add a user to the manager-gui role (to the correct tomcat_user.xml file), required for access to the Tomcat Manager, Tomcat stopped presenting the login dialog and went directly to the 401 access denied splash page.

当我尝试将用户添加到 manager-gui 角色(添加到正确的 tomcat_user.xml 文件)时,这是访问 Tomcat 管理器所需的,Tomcat 停止显示登录对话框并直接转到 401 访问被拒绝启动页面。

It appears that the NetBeans package uses a locked-down version of TomCat.

NetBeans 包似乎使用了 TomCat 的锁定版本。

I hope this saves everyone some time.

我希望这可以为大家节省一些时间。