You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sudhir, Arun" <Ar...@fmr.com> on 2008/06/10 21:54:47 UTC

How can I run one particular webapp as a different user?

I'm using Tomcat in Linux and when I use Runtime.exec from Tomcat, the
unix commands run as user "dingo". But I have another user "aruns" and I
would like ONE AND ONLY ONE of my web applications to use Runtime.exec()
to run a perl script as user "aruns" and not as user "Dingo". Is this
possible? If so how ?

Arun


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


Re: How can I run one particular webapp as a different user?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Arun,

Sudhir, Arun wrote:
| Do you mean to say that every webapp is a separate thread?

No.

| So
| the userid for the Runtime.exec() would be the id of the user starting
| the servlet conatiner (by running startup.sh)?

Yes. Child processes inherit the euid of the parent process.

| Is there a place like a
| catalina.policy or something where I can say "hey tomcat, this is userid
| with which you should runall Runtime.exec() calls!".  :) (Too much to
| ask ?? )

Java does not allow you to do this, so I would imagine that Tomcat can't
either.

On UNIX systems, running a process as another user is as simple as using
the "su" command (or "sudo", if you have that set up). Try looking at
the man pages for those two commands and you should be able to figure
out how to run one command as another user.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhO5xEACgkQ9CaO5/Lv0PARsgCfeN86bIudAh3jbB15itWD8iww
3MAAmQFyVY0hjMKgzxsY7Ue8h9cB2yjI
=YnF6
-----END PGP SIGNATURE-----

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


RE: How can I run one particular webapp as a different user?

Posted by "Sudhir, Arun" <Ar...@fmr.com>.
Chris,
        Do you mean to say that every webapp is a separate thread? So
the userid for the Runtime.exec() would be the id of the user starting
the servlet conatiner (by running startup.sh)? Is there a place like a
catalina.policy or something where I can say "hey tomcat, this is userid
with which you should runall Runtime.exec() calls!".  :) (Too much to
ask ?? ) 

Arun

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, June 10, 2008 4:07 PM
To: Tomcat Users List
Subject: Re: How can I run one particular webapp as a different user?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Arun,

Don't hijack threads :(

Sudhir, Arun wrote:
| I'm using Tomcat in Linux and when I use Runtime.exec from Tomcat, the
| unix commands run as user "dingo". But I have another user "aruns" and
I
| would like ONE AND ONLY ONE of my web applications to use
Runtime.exec()
| to run a perl script as user "aruns" and not as user "Dingo". Is this
| possible? If so how ?

How would you do this on the command-line?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhO3tkACgkQ9CaO5/Lv0PBFuACeLeZPJhQ26SCEk1V0KgmBC0Bc
HcoAoK4r5/bGbe7rtg1psrHbv4yH/Q2S
=1nyA
-----END PGP SIGNATURE-----

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



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


Re: How can I run one particular webapp as a different user?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Arun,

Don't hijack threads :(

Sudhir, Arun wrote:
| I'm using Tomcat in Linux and when I use Runtime.exec from Tomcat, the
| unix commands run as user "dingo". But I have another user "aruns" and I
| would like ONE AND ONLY ONE of my web applications to use Runtime.exec()
| to run a perl script as user "aruns" and not as user "Dingo". Is this
| possible? If so how ?

How would you do this on the command-line?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhO3tkACgkQ9CaO5/Lv0PBFuACeLeZPJhQ26SCEk1V0KgmBC0Bc
HcoAoK4r5/bGbe7rtg1psrHbv4yH/Q2S
=1nyA
-----END PGP SIGNATURE-----

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