open() throws permission error and I don't get why

2010-10-15 Thread Andy Theuninck
I'm trying to write a script to read e-mail over stdin, extract
attachments, and distribute them around the file system based on the
incoming e-mail address.

Everything works until I actually try writing interesting file system locations.

I've established, through logging, that postfix runs my script with
UID nobody & GID nobody. The directory I'm attempting to write has
permissions 0770. The directory's group is not nobody, but the user
nobody is a member of the relevant group. Nevertheless, python throws
an IOError when I try to create a file there.

The issue seems to be isolated to python. I can run:
sudo -u nobody touch DIRECTORY_IN_QUESTION/test
and that creates a file.

Any ideas?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: open() throws permission error and I don't get why

2010-10-15 Thread Andy Theuninck
> I suspect that postfix is only setting the UID and the (primary) GID,
> but not the supplementary GIDs. In which case, it doesn't matter whether
> "nobody" is a member of the group.

That does seem like a good explanation. I guess I'll have to re-think
my approach a bit. sg sounds like it would give me a different group,
but multiple GIDs was really what I was looking for. Back to the
drawing board...

Thanks for the explanation though.
-- 
http://mail.python.org/mailman/listinfo/python-list