@[email protected]
1. $ ls $CATALINA_BASE
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp
webapps work
When I run startup.sh it shows this:
$ $CATALINA_BASE/bin/startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/
Using CLASSPATH:
/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.
I have the variables set in .bashrc, but I'm not sure if there's another
way I need to set them.
2. $ cat $CATALINA_BASE/conf/server.xml
<?xml version="1.0" encoding="UTF-8"?>
...
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="tomcat-users.xml" />
</GlobalNamingResources>
...
I changed the path from "conf/tomcat-users.xml" to just "tomcat-users.xml"
because it's already in the conf folder but it didn't seem to make a
difference.
3. <Engine name="Catalina" defaultHost="localhost">
...
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
...
</Engine>
Don't know to much about Realms but it seems to be ok with the default
values.
4. I've been restarting my server and running shutdown.sh startup.sh often.
Thank you for the responses but I still can't figure out what's wrong. Let
me know if you have any more suggestions. If you want to look for yourself
you can log in with
ssh [email protected]
s3cret
cd /opt/tomcat
On Thu, Apr 5, 2018 at 10:54 AM, Christopher Schultz <
[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Philip,
>
> On 4/5/18 12:37 AM, Philip Rego wrote:
> > http://24.0.5.14:8081/manager/html
>
> Reach? Yes. Login? No.
>
> > *tomcat-users.xml*<xml version="1.0" encoding="UTF-8"?>
> > <tomcat-users xmlns="http://tomcat.apache.org/xml"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
> > version="1.0"> <role rolename="manager-gui"/> <user
> > username="tomcat" password="s3cret" roles="manager-gui"/> <role
> > rolename="tomcat"/> <role rolename="role1"/> <role
> > rolename="manager-gui"/> <user username="hello" password="p4ssw0rd"
> > roles="manager-gui"/> <user username="tomcat" password="p4ssw0rd"
> > roles="standard,manager-gui,tomcat,manager-script,manager-script"/>
> >
> >
> <role rolename="manager"/>
> > <user username="admin" password="admin" roles="manager"/>
> > </tomcat-users>
>
> I tried users "tomcat" and "hello". Your file looks okay to me.
>
> > Why can't I log in? I get a 401 error when I try with any these
> > users. Do I have them set correctly? The 401 error said I can get
> > access by adding the user "tomcat" like I so. I also read the
> > documentation
> > <http://24.0.5.14:8081/docs/manager-howto.html#Configuring_Manager_App
> lication_Access>
> >
> >
> but
> > I must not understand. I tried running tomcat on my windows
> > computer and got a similar 403 error. I originally had this issue
> > when I was trying to integrate my Spring Boot app in Jenkins and
> > got error
> >
> > org.codehaus.cargo.container.tomcat.internal.TomcatManagerException:
> >
> >
> The username and password you provided are not correct (error 401).
> >
> > (I know it's not safe giving out passwords like this but there's
> > nothing on the machine I care about, and want to have the issue
> > resolved)
>
> My guess is that one or more of the following is true:
>
> 1. The tomcat-users.xml file isn't in your CATALINA_BASE/conf/ directory
>
> 2. Your CATALINA_BASE/conf/server.xml does not have a <Resource> in it
> for MemoryUserDatabaseFactory
>
> 3. Your Manager application doesn't have a <Realm> configured
>
> Can you confirm all of the above?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlrGOKYACgkQHPApP6U8
> pFh/RBAAq7PwPcwQ9HjBLne2qf5K1WJBO7gVSBUsJ9nVlkcgwnnlJhN4bI9tW69G
> vuovsDZKuWPYNrh/1IqNjJ9DUxrO7bitO07AOJRpQcKsdtYeLx6k6xMdBj4bi/Vr
> ysHm41pv6rT0YxAN3oBUaDWbG32CNIhKz6LOos1iKJ7/k4OH5KJsUy4pXDce2Rop
> ybP7iuB8bmrx7TYHlKrtoNCUAQs0ah+0xlQ7kmrzgVKHhotKjukCmMLifaYZ823A
> 7HI4x/XF3xx202dSuUx7OMwBNlDcU8SOEt/cXsU1bRVUfeRK/tm1RVogoe2+hDZW
> eIIpdnPnpsJaMp5FpBaS+VybHwjKfZyfY4rCl2q1lF3bRPDP6b9Xzu67+C6z0pnU
> 6LD4IKxIVMrPSwk3aTLcfrSvmUPla2nWV1Mp/KOl1QacQsBHW5LWA/Z+EAV6BaOU
> foG+V7ICdEWri4G1x6uAlFgbfgQe+1nIfUpJ+8dpI0uW9wY56nMzKHF3Hj65KkBq
> yOT00WxPLwhlNGre5dDLeoeN8i6ft9lxKvt+W1b58H9whySmhL2xULPIW9oPk1I2
> Ua3Z17JkQSJKcX2EONW/T4vwGhhRFEXMmcge3tMWlpB4jch7CXJ5zFgUHzn2UB1R
> NHLCtnxgTEJ2s6clckxuR+jMNl0+mktTcnGTUadpc6Cw0/hWvSg=
> =3lRR
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the
AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
This connector uses the APR/native implementation which always uses
OpenSSL for TLS.
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
certificateFile="conf/localhost-rsa-cert.pem"
certificateChainFile="conf/localhost-rsa-chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
<xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<user username="hello" password="p4ssw0rd" roles="manager-gui"/>
<user username="tomcat" password="p4ssw0rd" roles="standard,manager-gui,tomcat,manager-script,manager-script"/>
<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>
</tomcat-users>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]