• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

I cant su tomcat

Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I installed tomcat 8 on linux.
I edit tomcat-users.xml and restart tomcat couple of times and I still cant su to tomcat with password tomcat.
what to do?

below is my tomcat-users.xml :

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


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
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"/>

<role rolename="admin"/>
<role rolename="admin-gui"/>
<!-- <role rolename="admin-script"/> -->
<!-- <role rolename="manager"/> -->
<!-- <role rolename="manager-gui"/> -->
<!-- <role rolename="manager-script"/> -->
<!-- <role rolename="manager-jmx"/> -->
<!-- <role rolename="manager-status"/> -->
<user name="admin" password="adminadmin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />

Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you set up an actual "tomcat" user?

Command would have been something like:

You can check if the tomcat user exists by grepping your /etc/passwd file
Saloon Keeper
Posts: 26020
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The tomcat-users.xml file does not define or reference OS userids. It's strictly a database that contains userids, passwords, and user role assignments used by some of the Tomcat Realm plugins. It's not even used if you're using a Realm that employs a SQL database, LDAP server, web-service or other Realm that's not a descendent of the MemoryRealm.

The "su" command switches an OS user's identify to be that of another OS user. So if you want to "su tomcat", you have to have defined "tomcat" as an OS userid, regardless of what (if any) Tomcat security Realm(s) your webapps are running under. See Sam's post for more on how to do that.
I'm not sure if I approve of this interruption. But this tiny ad checks out:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic