Paramiko sudo no prompt

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