in reply to Ongoing chmod lack of success

Check out the umask function.