【问题标题】:server.xml and tomcat-users.xml file location in amazon elastic beanstalkamazon elastic beanstalk中的server.xml和tomcat-users.xml文件位置
【发布时间】:2017-10-12 22:24:11
【问题描述】:
我需要更新弹性 beanstalk 实例中的 tomcat-users.xml 才能使基于表单的身份验证正常工作。我能够使用 SSH 连接到弹性 beanstalk AMI 目录。但是,即使经过所有搜索,我也找不到 tomcat-users.xml 文件。在我的本地主机上,它位于“服务器”文件夹下。如果您能告诉我文件的位置以及我是否可以通过 SSH 修改它,我将不胜感激。
【问题讨论】:
标签:
xml
amazon-web-services
tomcat
【解决方案1】:
如果您可以发出命令ps -ef | grep tomcat,您将能够找出路径。如果我是正确的,它应该在位置/usr/share/tomcat
【解决方案2】:
尚未测试,但我找到了这篇文章:
http://www.michaelwilliams.co.za/amazon-ec2-elastic-beanstalk-basic-authentication/
表示如下:
通常你会在 Tomcat conf 中编辑 tomcat-users.xml 文件
目录。相反,我们将在 web 中创建一个 users.xml 文件
应用程序 WEB-INF 目录。此文件包含的凭据
将被授予访问更新目录的用户。
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
<role rolename="netbeans-application"/>
<user username="user1" password="password" roles="netbeans-application"/>
<user username="user2" password="password" roles="netbeans-application"/>
<user username="user3" password="password" roles="netbeans-application"/>
</tomcat-users>
您的应用程序没有在寻找用户
默认情况下,users.xml 中的凭据信息。展示你的
应用程序在哪里可以找到用户信息创建文件
web 应用程序的 META-INF 目录中的 context.xml。
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/EC2Example">
<Realm className="org.apache.catalina.realm.MemoryRealm" pathname="/opt/tomcat7/webapps/ROOT/WEB-INF/users.xml"/>
</Context>