tomcat的用户名和密码

昨天把Linux下的tomcat安装了,但是一直不能从localhost:8080中进入“tomcat manager”。

后来看了网上的介绍,发现修改/conf/tomcat-users.xml就可以了。

需要注意的是:

1.将围住role和user定义行的注释去掉。

2.添加role(名字在NOTE注释给出),并添加属于该role的user。

其实上面两点,在tomcat-users.xml内都有说明。我使用的这个版本,在<tomcat-users>...</tomcat-users>中就有两个NOTE注释:

<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->

所以我所需要做的,就是添加这样两行:

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

然后以admin用户登录“tomcat manager”,就能进去了。

posted @ 2012-08-16 09:18  peaceful  阅读(395)  评论(0)    收藏  举报