samatovS
samatovS

Reputation: 432

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.

Upvotes: 2

Views: 4743

Answers (2)

jordi
jordi

Reputation: 1187

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>

Upvotes: 1

Vishnu T S
Vishnu T S

Reputation: 3934

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

Upvotes: 2

Related Questions