Voici le script.
Je voulais me connecter à plusieurs serveurs et vérifier la version du noyau.
#!/bin/bash
#input server names line by line in server.txt
cat server.txt | while read line
do
sshpass -p password ssh root@$line << EOF
hostname
uname -r
EOF
done
Je m'attendrais à une sortie qui va comme ..
server1_hostname
kernel_version
server2_hostname
kernel_version
etc..
J'ai exécuté ce script avec environ 80 serveurs dans server.txt
Et la sortie que j'ai obtenue était comme .....
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
========================================================================
================================ WARNING ===============================
========================================================================
This system is solely for the use of authorized personnel. Individuals
using this system are subject to having some or all of their activities
monitored and recorded. Anyone using this system expressly consents to
such monitoring and is advised that any unauthorized or improper use of
this system may result in disciplinary action up to and including
termination of employment. Violators may also be subject to civil and/or
criminal penalties.
========================================================================
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
xxxxdev01
2.6.32-431.23.3.el6.x86_64
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Ici, j'ai obtenu la sortie pour seulement 1 hôte, ce qui est xxxxdev01
également le cas avec la bannière ssh et d'autres avertissements.
J'ai besoin de la sortie de tous les autres hôtes et sans bannière ssh .. Qu'est-ce qui ne va pas ici?
ssh -t -t root@
... pour forcer un pseudo-terminal.
sshpass -p password root@server histname
?