detect sudo needs and switch connections for any use-case

The following changeset detects if a user needs to `sudo` on the remote end by getting the current user. If the current user is the `root` user, then `sudo` is disabled.

This should fix the unnecessary (and sometimes problematic) abuse of sudo that can trigger the sudoers error:

    sudo: sorry, you must have a tty to run sudo

root users do not need sudo.