[Twisted-web] default file creation when using reactor.spawnProcess

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Aug 29 13:03:29 EDT 2011

On Aug 29, 2011, at 9:50 AM, Stephan wrote:

> what I'd like is for the twistd daemon to create files with a certain
> default file creation permission, so I'm looking at changing the
> umask,
> but so far I can't get the format correctly, as I'm trying to use what
> I'd normally use for chmod
> when starting twistd what is the correct format for umask? is what I
> have correct?
> desired result is rw for owner, group and world.

Not just in twistd, the terms "umask" and "chmod" are basically inverses.  chmod sets the permissions of a file to a particular set of bits, but umask _masks out_ those bits on newly created files.

The mask you want is "execute for everybody" (0b001001001) but you're currently specifying "everything but execute for everybody" (0b110110110).  The Python interpreter can help you coerce this to octal, for use as a --umask command line option:

>>> oct(0b001001001)

Hope this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20110829/ab2caec2/attachment.htm 

More information about the Twisted-web mailing list