473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

running an app as user "foo"

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
Jul 31 '06 #1
1 1437
bruce wrote:
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

Jul 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thomas Guettler | last post by:
Hi, Python 2.3.3 (#1, Feb 5 2005, 16:22:10) on linux2 >>> assert 0, "foo" Traceback (most recent call last): File "<stdin>", line 1, in ? AssertionError: foo >>> assert(0, "foo") >>>
9
by: David D. | last post by:
Does the file extension matter when including a JavaScript file in an HTML page? Normally, one would include a JavaScript file in an HTML page using <script src="foo.JS" type="text/javascript">...
0
by: Daniel | last post by:
how to make sure a xsl document has valid xsl syntax? i tried loading it into an xml document but that doesnt show syntax errors inside attributes such as "foo/bar" vs "bar\foo"
5
by: vilhelm.sjoberg | last post by:
Hello, I am a resonably confident C programmer, but not very sure about the dark corners of C++. Recently, I had G++ give me a strange error. The program in question is in essence: struct...
37
by: Rajesh | last post by:
I was informed tht $SUBJECT was asked in M$ interview. Real imp. is no. of ways to achive it. mine sol. was.... int main() { if(printf("foo")) { ; } else { ; }
8
by: Mark | last post by:
Could someone provide me with details or a link on how the line of code executes underneath the hood? Assume it's executed in an ASP.NET application. string blah =...
1
by: dhtmlkitchen | last post by:
Why does "foo" instanceof String return false? It just seems counterintuitive to me. I mean, sure, I can always check the constructor: var fooVar = "foo"; var isString =...
30
by: kj | last post by:
My book (Flanagan's JavaScript: The Definitive Guide, 5th ed.) implies on page 111 that the following two constructs are equivalent: ( x.constructor == Foo ) and ( x instanceof Foo ) The...
1
by: Sin Jeong-hun | last post by:
Hello. I used the same CookieContainer for several consecutive WebRequests, then I could see that it contains cookies for several domains. I examined the private m_domains and it contains a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.