Run program as another user

Run program as another user

Post by Rya » Wed, 20 Jan 1999 04:00:00

For some reason I think I should know how to do this, but I haven't
been able to get it to work yet.  Any help is much appreciated!

This really should be a simple problem.  We are using VisualAge Team
Connection for source code control, which uses IBM's DB2 underneath to
house the source code.  This requires that a user be created that owns
both the DB2 database instance and the Team Connection instance.  Code
is checked into and out of Team Connection via a client/server
architecture.  Therefore, both the database manager and the Team
Connection server daemons need to be running in order to use the
So what I want to do is be able to have my server daemons start up
whenever the machine is booted.  I have the syntax for the command and
all, and I can start the daemons from the command line.  My problem is
that the application will not allow them to be run as root -- they can
only be run as the instance owner.
I have been trying all day to write a program that will run setuid()
that will allow me to change to the process owner.  It seems that for
some reason I cannot change from root to the process owner, which is
keeping me from starting the daemons.
I am running on an RS/6000 Model R50, AIX 4.2.1.

Any ideas?



Run program as another user

Post by Nic » Wed, 20 Jan 1999 04:00:00

How about:

su - username -c '/path/command'

You may need to modify the syntax slightly if your `su' differs - `man
su'. Works for me :-)


-- Nic B. -- email "sky" at "wibble dot net" ------
-- UN*X Programmer, The Internet Group (NZ) Ltd. --
-- #include <stddisclaimer.h> ---------------------


1. run a non-root user's program from a non-root user

Hi Folks,

Here is the problem.

I have user A and user B (non-root users)

I need for user A to initiate a job as user B. How can this be done?

As you know, I can do this as root. I can start a process from root as
another user in the system (cron jobs come to my mind!) Is there a way
to do this for non-root users? I believe I need to be able to do
something like  as user A
"su - B" without being prompted for password.

Appreciate suggestions in advance.


BTW: I am using AIX 4.3.10

2. Where is SCO 5.04 cgi Directary

3. How to : Program still running after user logout

4. VGA under Linux

5. Run program as another user

6. Exchange Server

7. Getting login id of user running a program

8. Test to comp.os.linux.x

9. non-root user can't run certain programs

10. Running Program As Another User

11. problem on running a daemon program by other user

12. How to let normal users run SVGALIB programs (SOLN)

13. I can't run programs as ROOT, but ok as other users!