make sure tempdir() and working directory are owned by the owner of the process even if uid/gid is changed; create new tempdir() if needed