tomcat 用户名密码

在编程的时候我们经常在myeclipes中直接部署web程序,大多数情况下不会登陆tomcat,这样时间长了我们就忘记了tomcat的登陆用户名和密码,下面就说一下怎么找到tomcat的用户名和密码吧,
首先,你必须的知道你的tomcat安装在什么地方了,比如我的就装在 D:\Program Files\Apache Software Foundation下面;
接着,我们在安装文件夹下面找到tomcat-users.xml文件,一般情况下实在这样一个文件目录下面的  D:\Program Files\Apache Software Foundation\Tomcat 6.0\conf;
最后用记事本打开tomcat-users.xml文件,内容大概如下:
<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
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="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"/>
</tomcat-users>

这里我们发现没有manager的权限,而我们需要的就是在manager中操作,所以我们要创建一个manager的管理权限如下面红色部分


<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
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="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"/>

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

这样的话保存后关闭,然后重新启动tomcat就可以使用 用户名:admin  和密码:admin来登录manager管理了
 
==================================================================================
 

不同于以往的Tomcat版本,Tomcat7.0将manager角色细化为manager-gui,manager-script,manager-jmx,manager-status,所以要使用Tomcat7.0,需要首先去conf\tomcat-users.xml添加角色与用户信息,具体如下:

  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
<role rolename="manager-status"/>
  <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status"/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值