You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Maxfield, Rebecca A" <rm...@providence.edu> on 2016/08/29 18:20:07 UTC

Trouble setting TOMCAT_USER

Hi there!

In order to resolve an issue with a Tomcat web app, I’m trying to run Tomcat as a user other than the default user. Following other advice, I looked in the conf file (/etc/tomcat/tomcat.conf) for TOMCAT_USER and saw that it wasn’t set; however, my efforts to set it haven’t seemed to result in any change.

I wrote:
TOMCAT_USER=“myusername”
which is the same syntax as the other variables in the file, JAVA_HOME and so on. (Incidentally, these don’t echo in the command line, but Tomcat does seem to be running.)
I then restarted, but a look at the process list showed that it was still running as default user “tomcat” rather than as myusername.

What am I missing and how can I run Tomcat as another user?

Thanks!

Re: Trouble setting TOMCAT_USER

Posted by Coty Sutherland <cs...@redhat.com>.
Based on your usage of /etc/tomcat/tomcat.conf you must be running the
Fedora/EPEL or RHEL-7/CentOS-7 distribution of tomcat. Firstly, the
TOMCAT_USER is tomcat by default; this is configured in the init
script. For tomcat to start and be owned by a user other than tomcat,
you should just need to set TOMCAT_USER in the conf or sysconfig file.
However, given that I don't know what version you're using there could
be some bug preventing this from occurring. Another thing that you
need to ensure is that the new user that you're using has the correct
permissions to view config, write to logs, etc. If it's failing to
start because of those reasons, you should see it in the
service/systemctl output, or the init log (depending on which distro
you're using).

Typically distribution issues (this isn't a problem with core tomcat)
aren't discussed on this list, however if you find me (csutherl) on
freenode (typically in #tomcat) I can help you along with any Red Hat
distributions of tomcat.

On Mon, Aug 29, 2016 at 4:28 PM, Jorge Alfonso <jo...@qbex.com> wrote:
> My Apologies again
>
> -----Original Message-----
> From: André Warnier (tomcat) [mailto:aw@ice-sa.com]
> Sent: Monday, August 29, 2016 4:28 PM
> To: users@tomcat.apache.org
> Subject: Re: Trouble setting TOMCAT_USER
>
> Jorge,
> 1) don't top-post
>
> On 29.08.2016 21:50, Jorge Alfonso wrote:
>> In order to setup the users for Tomcat you have to edit the file
>>
>> tomcat-users.xml
>>
>> <tomcat-users>
>>   <role rolename="admin-gui"/>
>>    <role rolename="manager-gui"/>
>>    <role rolename="role1"/>
>>    <user username="Myadmin" password="s3cret" roles="admin-gui,
>> manager-gui"/>
>>    <user username="both" password="s3cret" roles=admin-script"/>
>>    <user username="role1" password="change" roles="role1"/>
>> </tomcat-users>
>>
>> Once the users are set, and you could have set several users depending
>> your need, shutdown and startup again your Tomcat and you would be
>> able to see it running for your user and managing it.
>>
>
> 2) this has nothing to do with the user under which Tomcat is running.
>
>>
>
> Rebecca,
>
>> -----Original Message-----
>> From: Maxfield, Rebecca A [mailto:rmaxfiel@providence.edu]
>> Sent: Monday, August 29, 2016 2:20 PM
>> To: users@tomcat.apache.org
>> Subject: Trouble setting TOMCAT_USER
>>
>> Hi there!
>>
>> In order to resolve an issue with a Tomcat web app, I'm trying to run
>> Tomcat as a user other than the default user. Following other advice,
>> I looked in the conf file (/etc/tomcat/tomcat.conf) for TOMCAT_USER
>> and saw that it wasn't set; however, my efforts to set it haven't
>> seemed to result in any change.
>>
>> I wrote:
>> TOMCAT_USER="myusername"
>> which is the same syntax as the other variables in the file, JAVA_HOME
>> and so on. (Incidentally, these don't echo in the command line, but
>> Tomcat does seem to be running.) I then restarted, but a look at the
>> process list showed that it was still running as default user "tomcat"
>> rather than as myusername.
>>
>> What am I missing and how can I run Tomcat as another user?
>>
>
> You do not say so, but from the above it is a valid guess that you are
> running tomcat under some flavor of Linux, and that you installed it from
> the package provided by that Linux distribution.
>
> Unfortunately, without more information, it is difficult to know how you are
> really starting tomcat, and what influence that "TOMCAT_USER" line really
> has in the big scheme of things.
>
> Try to be more explicit and provide some details, such as which Linux, what
> command you use to start/restart tomcat, what version of Tomcat that is,
> etc..
> We don't have a crystal ball here, so we don't know those things.
>
>
>
>> Thanks!
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Trouble setting TOMCAT_USER

Posted by Jorge Alfonso <jo...@qbex.com>.
My Apologies again 

-----Original Message-----
From: André Warnier (tomcat) [mailto:aw@ice-sa.com] 
Sent: Monday, August 29, 2016 4:28 PM
To: users@tomcat.apache.org
Subject: Re: Trouble setting TOMCAT_USER

Jorge,
1) don't top-post

On 29.08.2016 21:50, Jorge Alfonso wrote:
> In order to setup the users for Tomcat you have to edit the file
>
> tomcat-users.xml
>
> <tomcat-users>
>   <role rolename="admin-gui"/>
>    <role rolename="manager-gui"/>
>    <role rolename="role1"/>
>    <user username="Myadmin" password="s3cret" roles="admin-gui, 
> manager-gui"/>
>    <user username="both" password="s3cret" roles=admin-script"/>
>    <user username="role1" password="change" roles="role1"/> 
> </tomcat-users>
>
> Once the users are set, and you could have set several users depending 
> your need, shutdown and startup again your Tomcat and you would be 
> able to see it running for your user and managing it.
>

2) this has nothing to do with the user under which Tomcat is running.

>

Rebecca,

> -----Original Message-----
> From: Maxfield, Rebecca A [mailto:rmaxfiel@providence.edu]
> Sent: Monday, August 29, 2016 2:20 PM
> To: users@tomcat.apache.org
> Subject: Trouble setting TOMCAT_USER
>
> Hi there!
>
> In order to resolve an issue with a Tomcat web app, I'm trying to run 
> Tomcat as a user other than the default user. Following other advice, 
> I looked in the conf file (/etc/tomcat/tomcat.conf) for TOMCAT_USER 
> and saw that it wasn't set; however, my efforts to set it haven't 
> seemed to result in any change.
>
> I wrote:
> TOMCAT_USER="myusername"
> which is the same syntax as the other variables in the file, JAVA_HOME 
> and so on. (Incidentally, these don't echo in the command line, but 
> Tomcat does seem to be running.) I then restarted, but a look at the 
> process list showed that it was still running as default user "tomcat" 
> rather than as myusername.
>
> What am I missing and how can I run Tomcat as another user?
>

You do not say so, but from the above it is a valid guess that you are
running tomcat under some flavor of Linux, and that you installed it from
the package provided by that Linux distribution.

Unfortunately, without more information, it is difficult to know how you are
really starting tomcat, and what influence that "TOMCAT_USER" line really
has in the big scheme of things.

Try to be more explicit and provide some details, such as which Linux, what
command you use to start/restart tomcat, what version of Tomcat that is,
etc..
We don't have a crystal ball here, so we don't know those things.



> Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Trouble setting TOMCAT_USER

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
Jorge,
1) don't top-post

On 29.08.2016 21:50, Jorge Alfonso wrote:
> In order to setup the users for Tomcat you have to edit the file
>
> tomcat-users.xml
>
> <tomcat-users>
>   <role rolename="admin-gui"/>
>    <role rolename="manager-gui"/>
>    <role rolename="role1"/>
>    <user username="Myadmin" password="s3cret" roles="admin-gui,
> manager-gui"/>
>    <user username="both" password="s3cret" roles=admin-script"/>
>    <user username="role1" password="change" roles="role1"/>
> </tomcat-users>
>
> Once the users are set, and you could have set several users depending your
> need, shutdown and startup again your Tomcat and you would be able to see it
> running for your user and managing it.
>

2) this has nothing to do with the user under which Tomcat is running.

>

Rebecca,

> -----Original Message-----
> From: Maxfield, Rebecca A [mailto:rmaxfiel@providence.edu]
> Sent: Monday, August 29, 2016 2:20 PM
> To: users@tomcat.apache.org
> Subject: Trouble setting TOMCAT_USER
>
> Hi there!
>
> In order to resolve an issue with a Tomcat web app, I'm trying to run Tomcat
> as a user other than the default user. Following other advice, I looked in
> the conf file (/etc/tomcat/tomcat.conf) for TOMCAT_USER and saw that it
> wasn't set; however, my efforts to set it haven't seemed to result in any
> change.
>
> I wrote:
> TOMCAT_USER="myusername"
> which is the same syntax as the other variables in the file, JAVA_HOME and
> so on. (Incidentally, these don't echo in the command line, but Tomcat does
> seem to be running.) I then restarted, but a look at the process list showed
> that it was still running as default user "tomcat" rather than as
> myusername.
>
> What am I missing and how can I run Tomcat as another user?
>

You do not say so, but from the above it is a valid guess that you are running tomcat 
under some flavor of Linux, and that you installed it from the package provided by that 
Linux distribution.

Unfortunately, without more information, it is difficult to know how you are really 
starting tomcat, and what influence that "TOMCAT_USER" line really has in the big scheme 
of things.

Try to be more explicit and provide some details, such as which Linux, what command you 
use to start/restart tomcat, what version of Tomcat that is, etc..
We don't have a crystal ball here, so we don't know those things.



> Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Trouble setting TOMCAT_USER

Posted by Jorge Alfonso <jo...@qbex.com>.
My Apologies

Just wanted to help 

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Monday, August 29, 2016 4:22 PM
To: Tomcat Users List
Cc: rmaxfiel@providence.edu
Subject: RE: Trouble setting TOMCAT_USER


> From: Jorge Alfonso [mailto:jorge@qbex.com]
> Subject: RE: Trouble setting TOMCAT_USER

> In order to setup the users for Tomcat you have to edit the file 
> tomcat-users.xml

???? That has absolutely nothing to do with what the OP is asking about.
The tomcat-users.xml file is the toy control for what users can be
authenticated and authorized by Tomcat, not what userid Tomcat runs under.

Unfortunately, the OP is using a 3rd-party repackaged version of Tomcat,
which the Apache organization has neither control nor even knowledge of.
Whatever startup mechanism that kicks off that particular Tomcat is specific
to the repackager, and the query will need to be submitted to whatevever
support organization that has.

 - Chuck 

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Trouble setting TOMCAT_USER

Posted by "Maxfield, Rebecca A" <rm...@providence.edu>.
OP here, I assumed (haven’t had a chance to try it yet) that the username I set TOMCAT_USER to would also have to be identified in tomcat-users.xml, but I take it from your response that that’s not correct.

I didn’t install tomcat on this server, but I think it was probably installed through yum.




On 8/29/16, 4:21 PM, "Caldarale, Charles R" <Ch...@unisys.com> wrote:

>
>> From: Jorge Alfonso [mailto:jorge@qbex.com] 
>> Subject: RE: Trouble setting TOMCAT_USER
>
>> In order to setup the users for Tomcat you have to edit the file
>> tomcat-users.xml
>
>???? That has absolutely nothing to do with what the OP is asking about.  The tomcat-users.xml file is the toy control for what users can be authenticated and authorized by Tomcat, not what userid Tomcat runs under.
>
>Unfortunately, the OP is using a 3rd-party repackaged version of Tomcat, which the Apache organization has neither control nor even knowledge of.  Whatever startup mechanism that kicks off that particular Tomcat is specific to the repackager, and the query will need to be submitted to whatevever support organization that has.
>
> - Chuck 
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Trouble setting TOMCAT_USER

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jorge Alfonso [mailto:jorge@qbex.com] 
> Subject: RE: Trouble setting TOMCAT_USER

> In order to setup the users for Tomcat you have to edit the file
> tomcat-users.xml

???? That has absolutely nothing to do with what the OP is asking about.  The tomcat-users.xml file is the toy control for what users can be authenticated and authorized by Tomcat, not what userid Tomcat runs under.

Unfortunately, the OP is using a 3rd-party repackaged version of Tomcat, which the Apache organization has neither control nor even knowledge of.  Whatever startup mechanism that kicks off that particular Tomcat is specific to the repackager, and the query will need to be submitted to whatevever support organization that has.

 - Chuck 

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Trouble setting TOMCAT_USER

Posted by Jorge Alfonso <jo...@qbex.com>.
In order to setup the users for Tomcat you have to edit the file

tomcat-users.xml

<tomcat-users>
 <role rolename="admin-gui"/>
  <role rolename="manager-gui"/>
  <role rolename="role1"/>
  <user username="Myadmin" password="s3cret" roles="admin-gui,
manager-gui"/>
  <user username="both" password="s3cret" roles=admin-script"/>
  <user username="role1" password="change" roles="role1"/>
</tomcat-users> 

Once the users are set, and you could have set several users depending your
need, shutdown and startup again your Tomcat and you would be able to see it
running for your user and managing it.


-----Original Message-----
From: Maxfield, Rebecca A [mailto:rmaxfiel@providence.edu] 
Sent: Monday, August 29, 2016 2:20 PM
To: users@tomcat.apache.org
Subject: Trouble setting TOMCAT_USER

Hi there!

In order to resolve an issue with a Tomcat web app, I'm trying to run Tomcat
as a user other than the default user. Following other advice, I looked in
the conf file (/etc/tomcat/tomcat.conf) for TOMCAT_USER and saw that it
wasn't set; however, my efforts to set it haven't seemed to result in any
change.

I wrote:
TOMCAT_USER="myusername"
which is the same syntax as the other variables in the file, JAVA_HOME and
so on. (Incidentally, these don't echo in the command line, but Tomcat does
seem to be running.) I then restarted, but a look at the process list showed
that it was still running as default user "tomcat" rather than as
myusername.

What am I missing and how can I run Tomcat as another user?

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org