[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

processs started by root but running as somebody else

How do you get a program to run under a different uid than the user that
started the program?

For example:  httpd on my computer is owned by root ; however, it
shows up in the process table as running under user "nobody".

I want to start a program during boot time and have it show up in the
process table with a user's uid instead of root's.
0
mag062397
Asked:
mag062397
1 Solution
 
mlevCommented:
If you want to start an existing program under another user, you can do that with "su <user> -c <program>"
If you do "su - <user> -c <program>", it will also get the user's default environment, run in their home dir etc.

If you are writing a program of your own that you'd like to change uid, it can be achieved with the setuid system call.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now