Mit SSH über Node.js
Ich versuche, führen Sie ssh-Kind-Prozess in node.js und die Kontrolle über mein Programm. Mein code:
var util = require('util');
var spawn = require('child_process').spawn;
var ssh = spawn('ssh', ['cloudstudios.ch']);
ssh.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ssh.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ssh.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
Kann ich das Passwort eingeben in der Konsole, aber ich kann nichts nach. Ich bekomme folgende Konsolen-Ausgabe:
stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
root@xxxxxxxxxxxxx.xx's password:
stdout: Linux v 2.6.32-5-xen-amd64 #1 SMP Wed Jan 12 05:46:49 UTC 2011 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
stderr: stdin: is not a tty
Hat jemand eine Idee, wie bekomme ich diese zu arbeiten?
Dank!
Check this out github.com/steelbrain/node-ssh
InformationsquelleAutor Van Coding | 2011-03-13
Du musst angemeldet sein, um einen Kommentar abzugeben.
versuchen, ein wenig änderung:
var ssh = spawn('ssh', ['-tt', 'xxx']);
und:
Danke! TTY-Sache ist jetzt behoben! Aber nach der Eingabe des Kennworts und drücken der enter-ich sehe keine Ausgabe von ssh. Eine Idee dafür?
Ich habe getestet, ob die Befehle, die ich geben Sie ausgeführt werden. Und das sind Sie! Ich nur don T get die Ausgabe der Befehle. Haben Sie eine Idee, wie man die fehlende Ausgabe?
Verwenden public-key-Authentifizierung statt?
Sie können pty.js für passoword senden von stackoverflow.com/a/9788213/153718
InformationsquelleAutor stack underflow
Ive erstellt einen SSHClient für node.js nun. Herunterladen können Sie sich den Quelltext an https://github.com/VanCoding/NodeSSH.
Hoffe, es wird helfen, einige andere Leute.
Ja, ich änderte meinen Namen, sorry.
Funktioniert das mit PuTTY unter Windows?
InformationsquelleAutor Van Coding