ssh2 cannot connect to target machine

Using node ssh2 prompts an error: sudo: sorry, you must have a tty to run sudo

Solution:
vi /etc/sudoers
comment out the Defaults requiretty line

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326528568&siteId=291194637