Sudo: Sorry, You Must Have a Tty to Run Sudo

This is generally enforced by having Defaults requiretty in the /etc/sudoers. No panic, there is an easy fix!

Replace Defaults requiretty by Defaults !requiretty in your /etc/sudoers. This will impact your global sudo configuration.

-> sudo vim /etc/sudoers

# Disable "ssh hostname sudo ", because it will show the password in clear. 
#         You have to run "ssh -t hostname sudo ".
#Defaults    requiretty

-> wq!

To do it only for the specific user:

Defaults    requiretty
Defaults:sam !requiretty