J'utilise uniquement le canal ssh (22) sans tunnel, en mettant en pratique le langage 'expect' (une couche sur 'tcl') : très simple pour des applications normales et très puissant pour régler des problèmes compliqués -> utile à connaître.
------------------------------------------- #!/usr/bin/expect spawn scp [EMAIL PROTECTED]:/filepath . expect "assword" send "xxxxxx\r" ------------------------------- change login, host et xxx par ce qu'il faut ;-) ---Attention--- comme on simule un stdin, il faut terminer les lignes de 'send' par un '\r' (carriage return, comme avec le clavier) et pas avec un '\n' ------------------------------------------------------------- tu peux alors raffiner en précisant plusieurs cas de figure dans l'instruction 'expect' (comme un case) en utilisant des expressions régulières : si tu reçois ceci, fait cela etc. Donc tu peux alors récupérer le fameux 'Host key verification failed' et prendre des dispositions. .......................... expect { "disk full" { send "echo 'on a besoin d'aide' | mail -s help [EMAIL PROTECTED] \r" } "ok" { send "echo 'tout va bien' | mail -s ok [EMAIL PROTECTED]" } } ................................... Mais dans le même script, tu peux aussi 1/ commencer par un spawn ssh [EMAIL PROTECTED] ~/bin/macommande avec macommande = programme de préparation au transfert, par ex expurger le .ssh/known_host 2/ puis lancer un spawn scp ... J'espère que cela va te donner l'envie de découvrir 'expect' (vraiment simple à mettre en oeuvre) On Wed, 2004-07-14 at 12:01, Vincent wrote: > Bonjour, > > > J'essaye d'automatiser des scp (transfert de fichier) vers des machines où je n > ai pas accès directement mais via un jump host. > > pour cela je créé le Tunnel ssh : > > ssh -N -L 1234:machinedest:22 jumhost > > Puis > ssh -p 1234 localhost > Ou scp > > Mais le prob c'est que le fichier .ssh/known_hosts retient le "host > identification" de la précédente connection => > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ > @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ > IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! > Someone could be eavesdropping on you right now (man-in-the-middle attack)! > It is also possible that the RSA host key has just been changed. > The fingerprint for the RSA key sent by the remote host is > 88:c1:d4:96:c5:25:ab: > Please contact your system administrator. > Add correct host key in /home/vincent/.ssh/known_hosts to get rid of this > message. > Offending key in /home/vincent/.ssh/known_hosts:29 > RSA host key for localhost has changed and you have requested strict checking. > Host key verification failed. > > > > comment faire pour éviter ce problème car tout les hosts vont s'appeller > localhost .. > > Y a t il moyen de contourner le contrôle du host ? > > Merci > > > _______________________________________________________ > Linux Mailing List - http://www.unixtech.be > Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux > Archives: http://www.mail-archive.com/[EMAIL PROTECTED] > IRC: chat.unixtech.be:6667 - #unixtech -- ------------------------------------------------------------ Dr Alain Empain <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Bioinformatics, Molecular Genetics, Fac. Med. Vet., University of Liège, Belgium Bd de Colonster, B43 B-4000 Liège (Sart-Tilman) WORK: +32 4 366 3821 FAX: +32 4 366 4122 HOME: rue des Martyrs,7 B- 4550 Nandrin +32 85 51 23 41 GSM: +32 497 70 17 64 _______________________________________________________ Linux Mailing List - http://www.unixtech.be Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux Archives: http://www.mail-archive.com/[EMAIL PROTECTED] IRC: chat.unixtech.be:6667 - #unixtech