added chmod function to set cfg file to 0600 mode