Checks the permissions on a given file.