Use double `-t` on the `ssh` command, it's necessary when `sudo` has `requiretty` enforced.