Consolidate permissions of temporary files on UNIX

Kudos to dmc for testing and figuring out the details.