Improved config file permissions handling and test coverage.