A possible fix for it is:
- add user in sudoers without password (or use ssh keys)
- on redhat systems (including centos) we still get:
sudo: sorry, you must have a tty to run sudo
To solve it , comment the line in /etc/sudoers using visudo :
Defaults requiretty