euid/egid eaten up by os.popen
Donn Cave
donn at u.washington.edu
Thu Jul 25 13:31:30 EDT 2002
Quoth janeaustine50 at hotmail.com (Jane Austine):
...
| When we print out geteuid from the python code, it prints out as we
| expect. However, when we call a popen, the pipe is run without the
| effective user/group id.
I bet you're running Linux. My suggestion is to try popen2, and
specify the command as a list of arguments. For example, if you
have been writing
fp = os.popen('id')
then try
fp, ignore = popen2.popen2(['id'])
The same goes for system(), incidentally - spawnv() will work better.
The problem is evidently caused by bash. If you contrive to run
bash to interpret the command string on some other platform, it
will happen the same way - it's only a Linux bug because Linux uses
bash here.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list