Catch permissions errors related to opening a known_hosts file in modules

Fixes #6644