Set permission to the generated file correctly