When you execute shell script from a browser or a ssh connection without password, if you got an error
Error :

sudo: sorry, you must have a tty to run sudo


We have two options to fix this error and remove it, just replace Defaults requiretty  to Defaults !requiretty in /etc/sudoers configure file.

#  vim  /etc/sudoers

Defaults    requiretty

Chnage to,

# Defaults    requiretty

Defaults    !requiretty

Another way is give permission at a command basis, per user, 

Defaults!/path/to/my/bin  !requiretty
Defaults:username  !requiretty