Depuis Server A :

cat /tmp/testssh
#!/bin/bash
echo "toto" >> /tmp/testtoto

execution :

cat /tmp/testssh |ssh linuxadmin2 "/bin/sh"


Vérification sur server B :

cat /tmp/testtoto
toto


## Recuperation des informations techniques d'un serveur ##
## depuis un serveur central : via un compte d'exploitation : user
## CPU / RAM / Disk / OS release / IP ##

LIST_CIBLE='/PATH_LIST'
USER_SSH='user'
SSH_KEY=~/.ssh/id_dsa
SSH_COMM='ssh -T -i '$SSH_KEY'  -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o ChallengeResponseAuthentication=no'


LOG_OUT='./scan.log_out'
ROTATE_LOG_OUT='./scan_cmdb.log_out.old'

mv $LOG_OUT $ROTATE_LOG_OUT
echo "NAME;OS;Number_of_Logical_Processor;RAM Allocated"

for i in $LIST_CIBLE
        do
$SSH_COMM $USER_SSH@$i <<'EOF'
echo "`hostname`;`head -1 /etc/redhat-release`;`grep -c ^processor /proc/cpuinfo`;`free -g | awk '/Mem/ {print \$2}'`"
EOF
done >> $LOG_OUT