Net::SSH::Perl
Publicado: 2010-04-19 09:30 @437
Hola, mi nombre es Leandro y soy nuevo en el foro, acudo a éste a ver si alguien puede ayudarme .
Estoy tratando de conectar con un servidor SSH desde código Perl. Estoy probando con la librería ésta, pero no me toma el password. Necesito que conecte sin tener que poner el password.
También probé el Net::SSH2 pero me tira o illegal o un error de segmentation.
Les dejo el código que tengo hecho pera la conexión.
Este código me tira esto:
Desde ya, muchas gracias.
Estoy tratando de conectar con un servidor SSH desde código Perl. Estoy probando con la librería ésta, pero no me toma el password. Necesito que conecte sin tener que poner el password.
También probé el Net::SSH2 pero me tira o illegal o un error de segmentation.
Les dejo el código que tengo hecho pera la conexión.
Using perl Syntax Highlighting
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Net::SSH::Perl;
- my $host = '10.15.19.64';
- my $pass = 'usuario';
- my $user = 'password';
- my $cmd = 'pwd';
- #my $host = '10.225.173.148';
- #my $pass = 'argentina';
- #my $user = 'arg09';
- #my $cmd = 'pwd';
- my $ssh = Net::SSH::Perl->new($host, protocol => '2,1', debug => 1,interactive=>0);
- $ssh->login($user,$pass);
- my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
- print $stdout, "\n";
- exit;
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
Este código me tira esto:
Using text Syntax Highlighting
./test_lna.pl
gentoo: Reading configuration data /root/.ssh/config
gentoo: Reading configuration data /etc/ssh_config
gentoo: Allocated local port 1023.
gentoo: Connecting to 10.15.19.64, port 22.
gentoo: Remote version string: SSH-2.0-4.4.2.3 SSH Secure Shell
gentoo: Remote protocol version 2.0, remote software version 4.4.2.3 SSH Secure Shell
gentoo: Net::SSH::Perl Version 1.30, protocol version 2.0.
.entoo: No compat match: 4.4.2.3 SSH Secure Shell
gentoo: Connection established.
gentoo: Sent key-exchange init (KEXINIT), wait response.
gentoo: Algorithms, c->s: 3des-cbc hmac-sha1 none
gentoo: Algorithms, s->c: 3des-cbc hmac-sha1 none
gentoo: Entering Diffie-Hellman Group 1 key exchange.
gentoo: Sent DH public key, waiting for reply.
gentoo: Received host key, type 'ssh-dss'.
gentoo: Host '10.15.19.64' is known and matches the host key.
gentoo: Computing shared secret key.
gentoo: Verifying server signature.
gentoo: Waiting for NEWKEYS message.
gentoo: Enabling incoming encryption/MAC/compression.
gentoo: Send NEWKEYS, enable outgoing encryption/MAC/compression.
gentoo: Sending request for user-authentication service.
gentoo: Service accepted: ssh-userauth.
gentoo: Trying empty user-authentication request.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive.
gentoo: Next method to try is publickey.
Permission denied at ./test_lna.pl line 20
gentoo: Reading configuration data /root/.ssh/config
gentoo: Reading configuration data /etc/ssh_config
gentoo: Allocated local port 1023.
gentoo: Connecting to 10.15.19.64, port 22.
gentoo: Remote version string: SSH-2.0-4.4.2.3 SSH Secure Shell
gentoo: Remote protocol version 2.0, remote software version 4.4.2.3 SSH Secure Shell
gentoo: Net::SSH::Perl Version 1.30, protocol version 2.0.
.entoo: No compat match: 4.4.2.3 SSH Secure Shell
gentoo: Connection established.
gentoo: Sent key-exchange init (KEXINIT), wait response.
gentoo: Algorithms, c->s: 3des-cbc hmac-sha1 none
gentoo: Algorithms, s->c: 3des-cbc hmac-sha1 none
gentoo: Entering Diffie-Hellman Group 1 key exchange.
gentoo: Sent DH public key, waiting for reply.
gentoo: Received host key, type 'ssh-dss'.
gentoo: Host '10.15.19.64' is known and matches the host key.
gentoo: Computing shared secret key.
gentoo: Verifying server signature.
gentoo: Waiting for NEWKEYS message.
gentoo: Enabling incoming encryption/MAC/compression.
gentoo: Send NEWKEYS, enable outgoing encryption/MAC/compression.
gentoo: Sending request for user-authentication service.
gentoo: Service accepted: ssh-userauth.
gentoo: Trying empty user-authentication request.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive,password.
gentoo: Next method to try is publickey.
gentoo: Next method to try is password.
gentoo: Trying password authentication.
gentoo: Authentication methods that can continue: hostbased,publickey,keyboard-interactive.
gentoo: Next method to try is publickey.
Permission denied at ./test_lna.pl line 20
Coloreado en 0.000 segundos, usando GeSHi 1.0.8.4
Desde ya, muchas gracias.