Bonjour,

je dois reprendre un script perl.
l'objectif du script est de se connecter sur des equipements en SSH.
le script fonctionne très bien pour un grand nombre d'equipement, mais j'essaie d'en rajouter un et ca ne fonctionne pas.

je vous montre le script

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
use Net::SSH::W32Perl;
use Net::Ping ;
use Time::Local ;
 
 
$ssh = new Net::SSH::W32Perl ($host, debug => 1) ;
print "ok \n";
print "authentification en cours ....\n";
$mypwd = '######'
$ssh->login ('root', $mypwd) ;
print "ok \n";
voici le résultat

perl verif_rs_v4.pl
myHost: Reading configuration data /.ssh/config
myHost: Reading configuration data /etc/ssh_config
myHost: Connecting to X.X.X.X port 22.
myHost: Socket created, turning on blocking...
myHost: Remote protocol version 2.0, remote software version OpenSSH_3.8.1p1 Debian-8.sarge.4
myHost: Net::SSH:erl Version 1.23_01, protocol version 2.0.
myHost: No compat match: OpenSSH_3.8.1p1 Debian-8.sarge.4.
myHost: Connection established.
connexion a X.X.X.X ...ok
authentification en cours ....
myHost: Sent key-exchange init (KEXINIT), wait response.
myHost: Algorithms, c->s: 3des-cbc hmac-sha1 none
myHost: Algorithms, s->c: 3des-cbc hmac-sha1 none
myHost: Entering Diffie-Hellman Group 1 key exchange.
myHost: Sent DH public key, waiting for reply.
myHost: Received host key, type 'ssh-dss'.
myHost: Host 'X.X.X.X' is known and matches the host key.
myHost: Computing shared secret key.
myHost: Verifying server signature.
myHost: Waiting for NEWKEYS message.
myHost: Enabling incoming encryption/MAC/compression.
myHost: Send NEWKEYS, enable outgoing encryption/MAC/compression.
myHost: Sending request for user-authentication service.
myHost: Service accepted: ssh-userauth.
myHost: Trying empty user-authentication request.
myHost: Authentication methods that can continue: publickey,keyboard-interactive.
myHost: Next method to try is publickey.
Permission denied at verif_rs_v4.pl line 67
il y a bien une entrée correspondant à mon équipement dans le fichier known_hosts2.

lorsque je fais en mode interactive ça fonctionne mais vu que le script est sensé se connecté tout seul ca ne me va pas.

de plus la connexion fonctionne via putty

est ce que quelqu'un a une idée?

merci d'avance