IOError - cannot create file (linux daemon-invoked script)
cassiope
fpm at u.washington.edu
Sat Jan 2 18:21:45 EST 2010
I have a daemon on a Linux system that supports a number of Windows
clients. Among the functions is to send e-mails, which is
sufficiently complicated that I fork() a separate process which gets
setuid to a lesser user, and calls a python script which does the
actual formatting and emailing (the daemon is written in C). I want
to save a copy of the email in a particular directory which is
accessible to the Windows clients via samba.
The strange thing is that even with the right user-id, I cannot seem
to write to the directory, getting an IOError exception. Changing the
directory to world-writable fixes this. I can confirm the uid and gid
for the script by having the script print these values just before
trying to create/write the file. Becoming the same lesser user, I
have no problem writing a file to the same directory.
Is there anything that I can do to diagnose why this script is
failing? For various reasons I don't want to make the directory world-
writable.
This is on a Debian "squeeze" system, with python 2.5.
Thanks for any insights!
More information about the Python-list
mailing list