Become another user

J

Joakim Hove

Hello,

[Disclaimer: This might really be a Unix question ?!]

I have written a cgi-script in python - it works reasonably well. The
script is invoked by the apache web server and runs as user
'wwwrun'.

During the execution of the script I want to save some files, as the
script is run bu user 'wwwrun' that is also the resulting ownership of
the files created. Since I don't have root access on the server these
files create some hassle.

Hence my question is whether it is possible (from the the python
script) to change identity 'wwwrun' -> 'myuser' during execution?



Best Regards

Joakim Hove

--
Joakim Hove
hove AT ntnu.no /
Tlf: +47 (55 5)8 27 13 / Stabburveien 18
Fax: +47 (55 5)8 94 40 / N-5231 Paradis
http://www.ift.uib.no/~hove/ / 55 91 28 18 / 92 68 57 04
 
J

Joel Hedlund

Look at the os module: http://docs.python.org/lib/os-file-dir.html
This has various functions you may find useful depending on how you
want to go about it, such as chmod and chown.

Correct me if I'm wrong, but doesn't this also require having a little chat
with the admin to set things up so the server has permission to give away files
to Joakim? Say, putting them in a common group or something?

Just making the files world readable may not be the best option (which I
believe is the only option otherwise).

Cheers!
/Joel Hedlund
 

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
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top