This is generally enforced by having Defaults requiretty in the /etc/sudoers. No panic, there is an easy fix!
-> 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!
Defaults requiretty Defaults:sam !requiretty
Thanks