-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hola On Tuesday 18 March 2003 01:05, Carlos Alberto Llano Rodriguez wrote: > Para accesar remotamente, ya sea por telnet o ssh y > que se ejecuten comandos en una maquina se puede > lograr por expect. > Aqui les mando un ejemplo.
Siempre es más recomendable utilizar claves RSA o DSA para la autenticación sin password contra ssh y de no poder ser perl con los módulos del CPAN para telnet o ftp dará mejor rendimiento y más seguridad que un script de expect > > #!/usr/bin/expect -f > > if $argc<2 { > send_user "$argv0: expect telnet.exp login pass\n" > exit > } > > set login [lindex $argv 0] > set password [lindex $argv 1] > > > set timeout 60 > spawn telnet "xxx.xx.x.xx" > expect "ogin:" > send -- "$login\r" > expect "assword:" > send -- "$password\n" > expect { > "Login" { puts "\n\nERROR: No se pudo establecer > conexion con el servidor, verificar login y > password\n";exit;} > timeout { puts "El programa ha finalizado por > tiempo.\n";exit} > } > > exit > > un saludo Victor -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD4DBQE+dulfEzqHF8R72ekRAsCeAJ9Jp6m8fA3r/tCrCiVfAhRff0JPeACTBVgi yklD5eL2FQC848V1pvP7iw== =GZWw -----END PGP SIGNATURE-----