Allow _remote_md5 to work with passwordless sudo even if password is supplied

Fix for #8418 - combines @sivel's #8900 pull request with an additional fix for paramiko connection (entirely based on @sivel's work)