running an app as user "foo"

B

bruce

hi.

within python, what's the best way to automatically spawn an app as a given
user/group.

i'm testing an app, and i'm going to need to assign the app to a given
user/group, as well as assign it certain access rights/modes (rwx) i then
want to copy the test app to a given dir, and then spawn a process to run
the app..

thanks
 
S

Simon Forman

bruce said:
hi.

within python, what's the best way to automatically spawn an app as a given
user/group.

i'm testing an app, and i'm going to need to assign the app to a given
user/group, as well as assign it certain access rights/modes (rwx) i then
want to copy the test app to a given dir, and then spawn a process to run
the app..

thanks

Look in the os module docs at the set*id() functions
http://docs.python.org/lib/os-procinfo.html

Then when you spawn the app using subprocess.Popen() you can pass a
function as the preexec_fn argument that changes the user and group ids
of the child "just before the child is executed"
http://docs.python.org/lib/node235.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top