2016-05-12 5 views
1

Angeblich übergibt die Option -x von pssh zusätzliche SSH-Befehlszeilenargumente. SSHs "-t" -Option hätte sich um den "Pseudo-Terminal" -Fehler kümmern müssen. Gibt es eine andere PSSH/SSH-Option, die verwendet werden sollte?"Force psuedo-tty allocation" übersetzt nicht in pssh

# pssh -i -H [email protected] -H [email protected] -x "-t -i /tmp/key.pem" 'sudo hostname' 
[1] 13:46:54 [FAILURE] [email protected] Exited with error code 1 
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal. 
sudo: sorry, you must have a tty to run sudo 
[2] 13:46:54 [FAILURE] [email protected] Exited with error code 1 
Stderr: Pseudo-terminal will not be allocated because stdin is not a terminal. 
sudo: sorry, you must have a tty to run sudo 

Ohne die „-t“ und die „sudo“, der Befehl funktioniert gut, aber ich brauche ein paar Befehle wie sudo auszuführen.

# pssh -i -H [email protected] -H [email protected] -x "-i /tmp/key.pem" 'hostname' 
[1] 14:08:35 [SUCCESS] [email protected] 
ip-10-0-0-140 
[2] 14:08:35 [SUCCESS] [email protected] 
ip-10-0-0-139 

Antwort

4

Versuchen pssh wie diese ausgeführt wird, so dass die "-t" Option zweimal angegeben wird:

pssh -i -H [email protected] -x "-t -t -i /tmp/key.pem" 'sudo hostname' 
          ^^^^^ 

Die ssh man page sagt über "-t" (Hervorhebung hinzugefügt):

-t
Pseudo-Terminal-Zuweisung erzwingen. Dies kann verwendet werden, um beliebige bildschirmbasierte Programme auf einem entfernten Rechner auszuführen, was sehr nützlich sein kann, z. wenn Sie Menüdienste implementieren. Multiple-t Optionen Kraft tty Zuordnung, auch wenn ssh hat keine lokale tty.

Sie sind offenbar pssh so ausgeführt, dass ssh hat keine lokale tty. Du musst also dafür sorgen, dass ssh zweimal mit "-t" ausgeführt wird. Dies zwingt ssh, ein Remote-tty anzufordern, obwohl kein lokales tty vorhanden ist.

+0

Obwohl das Trick gemacht hat, wird ein bizarrer Fehler erzeugt, aber der Fehler scheint die pssh-Ausführung nicht zu beeinflussen. – user2569618