百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> 修改tomcat用户名和密码的方法详解
分享文章到:

修改tomcat用户名和密码的方法详解

发布时间:01/15 来源: 浏览: 关键词:
为了方便远程管理tomcat我们可以给tomcat设置一个用户名和密码了,下面一起来看看具体的设置步骤,其实非常的简单在网上有很多相关的教程。


我们可以通过图形用户界面来管理tomcat,启动tomcat,在地址栏中输入:

http://localhost:8080  

就可以看见tomcat的欢迎页面,点击左边的tomcat manager  就会出现一个对话框,需要输入用户名和密码,当忘记最开始安装tomcat时的用户名和密码时,我们可以通过以下方杰来解决: 


修改tomcat-users.xml文件,这个文件在tomcat的安装目录下的conf目录下,打开这个文件,我们可以看到如下信息:

<tomcat-users>  
<!–  
  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=“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>  
我们在这里加上如下的一句话:
<user username=“admin” password=“admin” roles=“admin,manager”/>  
修改后的文件为:
<tomcat-users>  
<!–  
  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=“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=“admin,manager”/>  
</tomcat-users>  

重新启动tomcat服务器,这时,我们就可以使用用户名为admin,密码为admin的用户登录tomcat的管理界面了,这样,我们可以远程管理tomcat了

 

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有4人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板