简体   繁体   中英

server.xml and tomcat-users.xml file location in amazon elastic beanstalk

I need to to update the tomcat-users.xml in my elastic beanstalk instance in order for my form based authentication to work. I was able to connect to the elastic beanstalk AMI directory using SSH. However, even after all the searching I could not locate the tomcat-users.xml file. On my localhost it's under the 'Servers' folder. I would appreciate if you could tell me the location of the file and if I can modify it through the SSH.

not yet tested, but I have found this article:

http://www.michaelwilliams.co.za/amazon-ec2-elastic-beanstalk-basic-authentication/

It indicates the following:

Normally you would edit the tomcat-users.xml file in the Tomcat conf directory. Instead we'll create a users.xml file in the web application WEB-INF directory. This file contains the credentials of the users who will be given access to the updates directory.

<?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>

Your application is not looking for the user credential information in users.xml by default. To show your application where to find the user information create the file context.xml in the META-INF directory of your web application.

<?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>

You will be able to find out the path if you can issue the command ps -ef | grep tomcat ps -ef | grep tomcat . If I am correct it should be in location /usr/share/tomcat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM