cloudbuilders/devstack — comment on commit 47bb211cadbf2383c9e03f02858731e57ee3c4d9
File:  line 0
By xtoddx:

this fails because as soon as you write that file you lose the ability to sudo. I would make a temp file, make the right owner and permissions, and then cp -p.