How to best handle "sudo: no tty present and no askpass program specified"? I have custom Drush commands that contain shell commands with 'sudo' included. This results in an error when calling with remote alias to execute on remote instance:

drush @remote-alias custom-command-with-sudo


From research in google.com, I understand there is not tty session loaded when doing ssh user@ssh-server causing the error:

sudo: no tty present and no askpass program specified



https://unix.stackexchange.com/questions/48554/sudo-over-ssh-no-tty-present-and-no-askpass-program-specified
https://askubuntu.com/questions/271186/how-do-i-resolve-the-tty-problem


Can I configure drush to include -t flag when its doing ssh -t user@ssh-server. I understand this will load tty session and solve problem, am i wrong?...in short, how do you best overcame this issue? Thank you

UPDATE:
I followed instructions from similar question referred by Clive 


Added following line in .drush/drushrc.php:

$options['ssh-options'] = '-o PasswordAuthentication=no -i $HOME/.ssh/id_rsa/lamp_vbox';

Then I run in debug mode by adding --debug and this is what it shows:



  Calling proc_open(ssh -o PasswordAuthentication=no -i /Users/owner/.ssh/id_rsa/lamp_vbox margots@lamp-vbox 'COLUMNS=179 drush  --debug --uri=dev-metronic --root=/home/websites/dev/metronic --verbose  deploy-asset '\''@dev-metronic'\''   --ver=0.3 --asset=metronic --env=dev 2>&amp;1' 2>&amp;1);
          Starting Drush preflight. [0.06 sec, 1.51 MB]   


From the log, I conclude that the settings are being passed, however. I still get the error, so I wonder what could be the problem and how to solve it.

I'm using: Mac 10.9, Drush Version   :  7.0-dev
This may not be solution for everyone, but it worked in my situation because i could change settings at the remote instance. I followed the following instruction and turned on NOPASSWORD, which is adding the following line into sudoers file:

# Members of the admin group may gain root privileges
%admin  ALL=(ALL) ALL


Afterwards, my custom drush commands with sudo works on the remote instance