You might be able to do it using the getpass module to get the oracle
user's password, and then use something like
cmdin, cmdout = os.popen('su - oracle -c "cmd you want to run as oracle"')
cmdin.write(passwd + "\n")
to execute the command. I haven't actually tested this though.
Another way to do it would be to setuid your script, but this can cause
a whole lot of security problems. So don't do it. ;)
|
| I'm fairly new at Python and I'm thinking about writing some programs in for
| use at work on the Sun web servers we use. But I need to know something, I
| have a user on the system who delivers data for input into the Oracle
| database, and I'd like them to run some scripts to do it, rather than me
| doing all the time. However, to do this they have to 'su - oracle', in
| otherwords, the script would have to change userid and run some Oracle
| scripts than exit from that user and return to the delivery user. Can Python
| do this kind of thing? And if so, how?
--
cliff crawford http://www.people.cornell.edu/pages/cjc26/
"Blink your eyelids periodically to lubricate your eyes."