Use pty with ssh2 in node to execute command with sudo
I need to launch a command with sudo over ssh using npm ssh2 module for node.js; only reading module's documentation I can't figure out how to use the pty option: ssh.on('ready', function() { //not working sudo command: ssh.exec('cd /var/www/website && sudo mkdir myDir', { pty: true }, function(err, stream) { if (err) throw err; stream.on('exit', function(code, signal) { console.log('exit code: ' + code + ' signal: ' + signal); ssh.end(); }); }); }).connect({ host: configuration.sshAddress, port: 22, username: configuration.sshUser, password: configuration.sshPass }); Can someone explain the