IOError - cannot create file (linux daemon-invoked script)

Steve Holden steve at
Sun Jan 3 23:13:32 CET 2010

cassiope wrote:
> On Jan 2, 6:40 pm, Christian Heimes <li... at> wrote:
>> cassiope wrote:
>>> 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.
>> Are you able to write to the directory with the user id when you tried
>> to create a file manually?
> Yes.  Sorry that wasn't clear.
>> How are you changing the uid and gid of your script? IIRC you have to
>> set the effective user id with os.seteuid() and os.setegid().
> I'm changing the uid and gid in the daemon (which runs with root
> permissions
> until the fork and uid/gid change).  The uid and gid are confirmed by
> printing os.getuid() and os.getgid() in the script.
And what do os.geteuid() and os.getegid() report? I suppose it's
possible there's some bizarre difference between the effective and
actual process parameters. IS the filestore a local file system, or an
NFS mount?

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010
Holden Web LLC       

More information about the Python-list mailing list