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