ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 24)
Brought to you by:
dbrobins
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(15) |
Mar
(13) |
Apr
(8) |
May
(5) |
Jun
(21) |
Jul
(4) |
Aug
(9) |
Sep
(11) |
Oct
(14) |
Nov
(15) |
Dec
(24) |
2005 |
Jan
(10) |
Feb
(20) |
Mar
(16) |
Apr
(10) |
May
(12) |
Jun
(16) |
Jul
(18) |
Aug
(21) |
Sep
(11) |
Oct
(19) |
Nov
(16) |
Dec
(9) |
2006 |
Jan
(17) |
Feb
(32) |
Mar
(60) |
Apr
(21) |
May
(24) |
Jun
(1) |
Jul
(6) |
Aug
(18) |
Sep
(4) |
Oct
(9) |
Nov
(31) |
Dec
(10) |
2007 |
Jan
(8) |
Feb
(11) |
Mar
(3) |
Apr
(7) |
May
(4) |
Jun
(6) |
Jul
(7) |
Aug
(3) |
Sep
(2) |
Oct
(5) |
Nov
(5) |
Dec
(5) |
2008 |
Jan
(12) |
Feb
(5) |
Mar
(7) |
Apr
(4) |
May
(37) |
Jun
(9) |
Jul
(24) |
Aug
(5) |
Sep
(2) |
Oct
(7) |
Nov
(6) |
Dec
(7) |
2009 |
Jan
(18) |
Feb
(9) |
Mar
(14) |
Apr
(14) |
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(6) |
Sep
(4) |
Oct
(12) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
(4) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(5) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(9) |
Dec
(7) |
2012 |
Jan
(1) |
Feb
(19) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2014 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Watson, B. <Bra...@br...> - 2006-03-03 18:58:33
|
Hi all, I have written a simple script to ssh to a remote box using Net::SSH::Perl. It=20 works well enough when I supply the correct user name and password.=20 However, if I supply a bad user name or password, the script dies with the=20 following error: Received disconnect message: Too many authentication failures for bad_user at /usr/local/lib/perl5/site_perl/5.8.0/Net/SSH/Perl/AuthMgr.pm line 142 This behavior is undesired. I do not want the script to die. I want to be=20 able to test to see if authorization was successful and handle this error=20 myself, instead of dying. I have a long list of devices that I need to run commands on. If the script dies in the middle, I lose all info collected thus far as well as info that can be retrieved from other devices after the auth failure. I tried using the register_handler method with no success. Code examples using this method are hard to find. So I'm not sure if I am doing this correctly. Here is a stripped down version of my script: ------------------------------------------------------------------------ -------- #!/usr/bin/perl use strict; use Net::SSH::Perl; use Net::SSH::Perl::Constants qw( :agent ); my ($ip,$user,$passwd) =3D @ARGV; if (!$passwd) { print "USAGE: ssh_test_login.pl [device ip] [user] [password]\n"; exit; } my $ssh =3D Net::SSH::Perl->new($ip, protocol =3D> 2, debug =3D> 1, PreferredAuthentications =3D> 'password', PasswordAuthentication =3D> 'yes', PubkeyAuthentication =3D> 'no', RSAAuthentication =3D> 'no' ); $ssh->register_handler( SSH_AGENT_FAILURE,=20 sub { my($channel, $buffer) =3D @_; print "I received this: ", $buffer->bytes; } ); print "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = login attempt = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n"; $ssh->login($user, $passwd); print "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D run = command = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n"; my ($stdout, $stderr, $exit) =3D $ssh->cmd('ls /tmp'); print "EXIT CODE: $exit\n"; print "STDERR : $stderr\n"; print "STDOUT : $stdout\n"; exit; ------------------------------------------------------------------------ -------- Here is the output from the script: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D [root@h2o bin]# ./ssh_test_login.pl 10.128.1.165 bad_user bad_passwd h2o: Reading configuration data /root/.ssh/config h2o: Reading configuration data /etc/ssh_config h2o: Allocated local port 1023. h2o: Connecting to 10.128.1.165, port 22. h2o: Remote protocol version 1.99, remote software version OpenSSH_3.4-j2 h2o: Net::SSH::Perl Version 1.29, protocol version 2.0. h2o: No compat match: OpenSSH_3.4-j2. h2o: Connection established. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D login = attempt = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D h2o: Sent key-exchange init (KEXINIT), wait response. h2o: Algorithms, c->s: 3des-cbc hmac-sha1 none h2o: Algorithms, s->c: 3des-cbc hmac-sha1 none h2o: Entering Diffie-Hellman Group 1 key exchange. h2o: Sent DH public key, waiting for reply. h2o: Received host key, type 'ssh-dss'. h2o: Host '10.128.1.165' is known and matches the host key. h2o: Computing shared secret key. h2o: Verifying server signature. h2o: Waiting for NEWKEYS message. h2o: Enabling incoming encryption/MAC/compression. h2o: Send NEWKEYS, enable outgoing encryption/MAC/compression. h2o: Sending request for user-authentication service. h2o: Service accepted: ssh-userauth. h2o: Trying empty user-authentication request. h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Publickey: testing agent key '/root/.ssh/autorun/id_dsa' h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Next method to try is password. h2o: Trying password authentication. h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Publickey: testing agent key '/root/.ssh/autorun/id_dsa' h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Next method to try is password. h2o: Trying password authentication. h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Publickey: testing agent key '/root/.ssh/autorun/id_dsa' h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Next method to try is password. h2o: Trying password authentication. h2o: Authentication methods that can continue: publickey,password,keyboard-interactive. h2o: Next method to try is publickey. h2o: Publickey: testing agent key '/root/.ssh/autorun/id_dsa' Received disconnect message: Too many authentication failures for bad_user at /usr/local/lib/perl5/site_perl/5.8.0/Net/SSH/Perl/AuthMgr.pm line 142 [root@h2o bin]# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D On a different issue, you can see from this output that my options to the=20 Net::SSH:Perl->new method (ie PreferredAuthentications) are being ignored.=20 Any help is appreciated. Thanks, Brad |
From: J <mer...@ya...> - 2006-02-27 15:51:53
|
Actually in the scp_get method this line: my $chan = $self->_scp_get($remote, \%stat); was returning null. --- David Robins <dbr...@cp...> wrote: > On Friday February 24, 2006 07:33, J wrote: > > I just started using Net::SSH2 and I can connect > to a > > remote directory and list the files in that > directory. > > scp_get hangs and does not copy anything. > > Which version do you have? This might be related to > a bug fixed in the soon-to-be-released 0.07. > > -- > Dave > Isa. 40:31 > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a > groundbreaking scripting language > that extends applications into web and mobile media. > Attend the live webcast > and join the prime developer group breaking into > this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Curt S. <csh...@gm...> - 2006-02-27 15:31:25
|
I am trying to create a script that will get a document via sftp from a remote host. When I walk through the process manually everything is fine, but when I do the process via script I get Couldn't stat remote file: Permission denied at ./sftptest line 22 Below is the source for the script: ########Start Code############### #!/usr/bin/perl use strict; use Net::SFTP; use Net::SFTP::Util; use Net::SFTP::Constants; my $host = "testhost.test.com"; my $user = "username"; my $pass = "password"; my $port = "10022"; my $cmd = "get"; my $ldir = "/home/test"; my $rdir = "/"; my $localfile = 'username.test'; my $remotefile = 'username.test'; my $constatus = my $sftp = Net::SFTP->new("$host",user=>"$user",password=>"$pass",debug=>"1",ssh_args=> [port=>$port]); print "Connected!\n"; $sftp->$cmd("$rdir/$remotefile","$ldir/$localfile",\&callback); <- line 22 sub callback { my($sftp, $data, $offset, $size) = @_; print "Read $offset / $size bytes\r"; } ################End Code######################### If I change the $cmd to ls , this is successful but I cannot get the file. I have tried just "$remotefile","$localfile" (just for the record) rather than with the directory before it as well. Below is part of the debug file after connected: My.domain.name: Enabling incoming encryption/MAC/compression. My.domain.name: Send NEWKEYS, enable outgoing encryption/MAC/compression. My.domain.name: Sending request for user-authentication service. My.domain.name: Service accepted: ssh-userauth. My.domain.name: Trying empty user-authentication request. My.domain.name: Authentication methods that can continue: publickey,password,keyboard-interactive. My.domain.name: Next method to try is publickey. My.domain.name: Next method to try is password. My.domain.name: Trying password authentication. My.domain.name: Login completed, opening dummy shell channel. My.domain.name: channel 0: new [client-session] My.domain.name: Requesting channel_open for channel 0. My.domain.name: channel 0: open confirm rwindow 0 rmax 32768 My.domain.name: channel 1: new [client-session] My.domain.name: Requesting channel_open for channel 1. My.domain.name: Sending subsystem: sftp My.domain.name: Requesting service subsystem on channel 1. My.domain.name: channel 1: open confirm rwindow 0 rmax 32768 My.domain.name: sftp: Sending SSH2_FXP_INIT Mn.domain.name: sftp: Remote version: 3 My.domain.name: sftp: Sent message T:17 I:0 My.domain.name: sftp: Received stat reply T:101 I:0 Couldn't stat remote file: Permission denied at ./sftptest line 22 Any suggestions? Thanks Curt |
From: Miky J <mi...@ya...> - 2006-02-27 09:14:54
|
These commands seem to have solved the problem > # mv /dev/random /dev/random.bak > # cp /dev/urandom /dev/random Thanx again --- Bryan Bueter <br...@bu...> a écrit : > > When i do strace on the program it get stuck there > > > > 5822 open("/dev/random", O_RDONLY|O_LARGEFILE) = > 4 > > 5822 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, > > 0xbfbdf468) = -1 EINVAL (Invalid argument) > > 5822 _llseek(4, 0, [0], SEEK_CUR) = 0 > > 5822 fstat64(4, {st_mode=S_IFCHR|0666, > > st_rdev=makedev(1, 8), ...}) = 0 > > 5822 fcntl64(4, F_SETFD, FD_CLOEXEC) = 0 > > 5822 read(4, "$\327\364\v\342", 21) = 5 > > 5822 read(4, "\20\235@\1\310W\2668", 16) = 8 > > 5822 read(4, "\2203\356\254\354]\266 ", 8) = 8 > > 5822 close(4) = 0 > > > > around the 2nd and 3rd read instruction. > > > > --- Miky J <mi...@ya...> a écrit : > > Looks like you are quickly running out of entropy. > Check for patches on > your OS that fix this, or do something like this: > > # mv /dev/random /dev/random.bak > # cp /dev/urandom /dev/random > > Though, expect that your not really getting random > numbers after making > this change. The better solution would be to fix > any os problems. You > might check for good entropy by doing this: > > # cat -uv /dev/random > > If you see stuff come by pretty fast, then this is > not the problem at all. > If it hangs after printing a few lines, then you > certainly have issues > generating enough entropy. > > Good luck. > > Bryan > http://www.sourceforge.net/projects/rover > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a > groundbreaking scripting language > that extends applications into web and mobile media. > Attend the live webcast > and join the prime developer group breaking into > this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com |
From: David R. <dbr...@cp...> - 2006-02-25 05:07:59
|
On Friday February 24, 2006 10:09, Bryan Bueter wrote: > >> I am trying to use the Net:SSH2 module but don't > >> want to use RSA key for > >> authentication. From looking at the documentation, > >> It doesn't seem to > >> support username:password authentication. > > You can use this to automatically prompt you: > > $ssh2->auth(username => $user, interact => 1); > > Or this if you have your password stored somewhere: > > $ssh2->auth_keyboard($user, $pass); Thanks for replying; also to clarify, it's "auth_keyboard" because that's what the SSH spec calls it; this is "keyboard-interactive" although I allow a password to be supplied directly. There _is_ a separate "password" authentication ("auth_password", natch) but some SSH servers will disable pure password authentication. The "auth" method, as shown above, is recommended because it will try various methods based on what you give it and what the server advertises that it supports. -- Dave Isa. 40:31 |
From: David R. <dbr...@cp...> - 2006-02-25 05:00:39
|
On Friday February 24, 2006 07:33, J wrote: > I just started using Net::SSH2 and I can connect to a > remote directory and list the files in that directory. > scp_get hangs and does not copy anything. Which version do you have? This might be related to a bug fixed in the soon-to-be-released 0.07. -- Dave Isa. 40:31 |
From: Bryan B. <br...@bu...> - 2006-02-24 18:09:12
|
> Yes it does support username and password: > > $ssh =3D Net::SSH::Perl->new($host, > PreferredAuthentications=3D>'password'); > > $ssh->login($login, $password); > I think the question was for Net::SSH2 > --- Bobby Jafari <bob...@se...> a =E9crit : > >> Hi All, >> >> >> >> I am trying to use the Net:SSH2 module but don't >> want to use RSA key for >> authentication. From looking at the documentation, >> It doesn't seem to >> support username:password authentication. >> >> >> You can use this to automatically prompt you: $ssh2->auth(username =3D> $user, interact =3D> 1); Or this if you have your password stored somewhere: $ssh2->auth_keyboard($user, $pass); Hope that helps. Bryan http://sourceforge.net/projects/rover |
From: Bryan B. <br...@bu...> - 2006-02-24 18:04:40
|
> When i do strace on the program it get stuck there > > 5822 open("/dev/random", O_RDONLY|O_LARGEFILE) =3D 4 > 5822 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, > 0xbfbdf468) =3D -1 EINVAL (Invalid argument) > 5822 _llseek(4, 0, [0], SEEK_CUR) =3D 0 > 5822 fstat64(4, {st_mode=3DS_IFCHR|0666, > st_rdev=3Dmakedev(1, 8), ...}) =3D 0 > 5822 fcntl64(4, F_SETFD, FD_CLOEXEC) =3D 0 > 5822 read(4, "$\327\364\v\342", 21) =3D 5 > 5822 read(4, "\20\235@\1\310W\2668", 16) =3D 8 > 5822 read(4, "\2203\356\254\354]\266 ", 8) =3D 8 > 5822 close(4) =3D 0 > > around the 2nd and 3rd read instruction. > > --- Miky J <mi...@ya...> a =E9crit : Looks like you are quickly running out of entropy. Check for patches on your OS that fix this, or do something like this: # mv /dev/random /dev/random.bak # cp /dev/urandom /dev/random Though, expect that your not really getting random numbers after making this change. The better solution would be to fix any os problems. You might check for good entropy by doing this: # cat -uv /dev/random If you see stuff come by pretty fast, then this is not the problem at all. If it hangs after printing a few lines, then you certainly have issues generating enough entropy. Good luck. Bryan http://www.sourceforge.net/projects/rover |
From: Miky J <mi...@ya...> - 2006-02-24 16:26:32
|
Yes it does support username and password: $ssh = Net::SSH::Perl->new($host, PreferredAuthentications=>'password'); $ssh->login($login, $password); --- Bobby Jafari <bob...@se...> a écrit : > Hi All, > > > > I am trying to use the Net:SSH2 module but don't > want to use RSA key for > authentication. From looking at the documentation, > It doesn't seem to > support username:password authentication. > > > > Have I misread the docs? Does the module support > username:password > authentication? > > > > Any tips and suggestion would be welcome? > > > > Regards > > Bobby > > > > ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com |
From: Bobby J. <bob...@se...> - 2006-02-24 16:00:12
|
Hi All, =20 I am trying to use the Net:SSH2 module but don't want to use RSA key for authentication. From looking at the documentation, It doesn't seem to support username:password authentication.=20 =20 Have I misread the docs? Does the module support username:password authentication? =20 Any tips and suggestion would be welcome? =20 Regards Bobby =20 |
From: J <mer...@ya...> - 2006-02-24 15:33:37
|
I just started using Net::SSH2 and I can connect to a remote directory and list the files in that directory. scp_get hangs and does not copy anything. --- snip ---> $ssh2 = Net::SSH2->new(); $ssh2->connect("servername"); if ($ssh2->auth_publickey(...)) { my $sftp = $ssh2->sftp; my $dir = '/remote dir/'; my $directory = $sftp->opendir($dir); while (my $item = $directory->read) { print "$item->{name}\n"; if ($item->{name} eq "test1.txt") { if ($ssh2->scp_get('remote dir/test1.txt', '/current dir/test1.txt')) { print"done"; } else { print "not done"; } } } } $ssh2->disconnect(); <--- end --- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Miky J <mi...@ya...> - 2006-02-24 13:30:55
|
When i do strace on the program it get stuck there 5822 open("/dev/random", O_RDONLY|O_LARGEFILE) = 4 5822 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfbdf468) = -1 EINVAL (Invalid argument) 5822 _llseek(4, 0, [0], SEEK_CUR) = 0 5822 fstat64(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 8), ...}) = 0 5822 fcntl64(4, F_SETFD, FD_CLOEXEC) = 0 5822 read(4, "$\327\364\v\342", 21) = 5 5822 read(4, "\20\235@\1\310W\2668", 16) = 8 5822 read(4, "\2203\356\254\354]\266 ", 8) = 8 5822 close(4) = 0 around the 2nd and 3rd read instruction. --- Miky J <mi...@ya...> a écrit : > Hello, > > I have a public key id_rsa in my .ssh directory. > When I use it it's very slow to connect to the > second, > thrid,... host. > If I rename this id_rsa, then I use passwords > everything and it's quick. > I have modules > IO::Handle > Math::BigInt::GMP > > Any hint ? > > #!/usr/bin/perl > > use IO::Handle; > use Net::SSH::Perl; > use Net::DNS; > use Getopt::Std; > use strict; > > my $login='root'; > my $password1='pass1'; > > my $password=$password1; > my ($ok,$notok,$total); > $total=$ok=$notok=0; > > my %cmd=(); > > $cmd{1}="uname -a"; > login('host1',%cmd); > login('host2',%cmd); > > sub login > { > my ($host,%mes_cmd) = @_; > my $ssh; > > $ssh = Net::SSH::Perl->new($host, debug=>1, > protocol=>'2', port=>22, > PreferredAuthentications=>'publickey,password', > identity_files => ["/home/mikydeb/.ssh/id_rsa"]); > > $ssh->login($login, $password); > my $resultat; > > print "$host"; > > print "\t"; > print "\t$password\n"; > for (keys %mes_cmd) > { > ($resultat) = $ssh->cmd($mes_cmd{$_}); > print "$host\t$resultat" if $resultat; > } > $password=$password1; > $ok++; > } > print "\n---------------------------------------\n"; > print "Nb total of machines: $total\n"; > print "Nb machines ok: $ok\n"; > print "Nb machines unreachable: $notok\n"; > print "---------------------------------------\n"; ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger. Appelez le monde entier à partir de 0,012 /minute ! Téléchargez sur http://fr.messenger.yahoo.com |
From: Miky J <mi...@ya...> - 2006-02-23 15:50:59
|
Hello, I have a public key id_rsa in my .ssh directory. When I use it it's very slow to connect to the second, thrid,... host. If I rename this id_rsa, then I use passwords everything and it's quick. I have modules IO::Handle Math::BigInt::GMP Any hint ? #!/usr/bin/perl use IO::Handle; use Net::SSH::Perl; use Net::DNS; use Getopt::Std; use strict; my $login='root'; my $password1='pass1'; my $password=$password1; my ($ok,$notok,$total); $total=$ok=$notok=0; my %cmd=(); $cmd{1}="uname -a"; login('host1',%cmd); login('host2',%cmd); sub login { my ($host,%mes_cmd) = @_; my $ssh; $ssh = Net::SSH::Perl->new($host, debug=>1, protocol=>'2', port=>22, PreferredAuthentications=>'publickey,password', identity_files => ["/home/mikydeb/.ssh/id_rsa"]); $ssh->login($login, $password); my $resultat; print "$host"; print "\t"; print "\t$password\n"; for (keys %mes_cmd) { ($resultat) = $ssh->cmd($mes_cmd{$_}); print "$host\t$resultat" if $resultat; } $password=$password1; $ok++; } print "\n---------------------------------------\n"; print "Nb total of machines: $total\n"; print "Nb machines ok: $ok\n"; print "Nb machines unreachable: $notok\n"; print "---------------------------------------\n"; ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com |
From: David R. <dbr...@cp...> - 2006-02-17 03:42:55
|
On Thursday February 16, 2006 11:27, Rutger Ovidius wrote: > Saturday, February 11, 2006, 8:18:21 AM, you wrote: > > RO> But scp_get does not work on files > 25k or so. For a 2k file, it works, but > RO> larger files receive a segmentation fault. > > RO> scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. > > I found the scp_get problem; the pv_buffer was being incremented and > then accessed at an incorrect position. (Requires a recompile of SSH2.xs). Fixed for 0.07, thanks. > The scp_put problem was patched by by R. Corbridge. stat[2] was being > used rather than stat[7] in SSH2.pm. I already picked that up, it will also be in 0.07. Thanks, -- Dave Isa. 40:31 |
From: Rutger O. <ov...@us...> - 2006-02-16 19:27:50
|
Saturday, February 11, 2006, 8:18:21 AM, you wrote: RO> But scp_get does not work on files > 25k or so. For a 2k file, it works, but RO> larger files receive a segmentation fault. RO> scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. I found the scp_get problem; the pv_buffer was being incremented and then accessed at an incorrect position. (Requires a recompile of SSH2.xs). The scp_put problem was patched by by R. Corbridge. stat[2] was being used rather than stat[7] in SSH2.pm. --- diff -r -u Net-SSH2-0.06-orig/SSH2.xs Net-SSH2-0.06/SSH2.xs --- Net-SSH2-0.06-orig/SSH2.xs 2005-11-29 19:54:08.000000000 -0800 +++ Net-SSH2-0.06/SSH2.xs 2006-02-16 11:00:57.000000000 -0800 @@ -1198,7 +1198,7 @@ pv_buffer = sv_grow(buffer, size + 1/*NUL*/); /* force PV */ again: - count = libssh2_channel_read_ex(ch->channel, XLATEXT, pv_buffer, size); + count = libssh2_channel_read_ex(ch->channel, XLATEXT, pv_buffer+total, size); debug("- read %d bytes\n", count); if (count < 0) { @@ -1211,7 +1211,6 @@ total += count; if (count > 0 && (unsigned)count < size) { - pv_buffer += count; size -= count; goto again; } diff -r -u Net-SSH2-0.06-orig/lib/Net/SSH2.pm Net-SSH2-0.06/lib/Net/SSH2.pm --- Net-SSH2-0.06-orig/lib/Net/SSH2.pm 2005-11-19 10:09:54.000000000 -0800 +++ Net-SSH2-0.06/lib/Net/SSH2.pm 2006-02-16 10:39:00.000000000 -0800 @@ -339,7 +339,7 @@ $chan->blocking(1); my $buf; - my $count = $file->sysread($buf, $stat[2]); + my $count = $file->sysread($buf, $stat[7]); $self->error($!, $!), return unless defined $count; $self->error(0, "want $stat[7], have $count"), return unless $count == $stat[7]; |
From: Rob V. <rob...@br...> - 2006-02-14 14:35:58
|
Hi, It seems that I managed to reproduce the bug you found Bryan. (the blocking flag wont work for me) If I use Net::SSH2 to connect to a suse linux 9.1 professional machine, I can issue multiple commands to the shell and read the channel and issue more commands. However if I try this on a debian machine it fails, I have to close the channel and open it again. Maybe the ssl version running on the remote machine makes a difference. ssl&ssh versions on suse box: sshd version OpenSSH_3.8p1, OpenSSL 0.9.7d kernel on suse box: Linux fil996 2.6.5-7.111.19-smp #1 SMP Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386 GNU/Linux17 Mar 2004 ssl&ssh versions on debian box: OpenSSH_3.8.1p1 Debian-8.sarge.4, OpenSSL 0.9.7e 25 Oct 2004 kernel on debian box: Linux eco 2.4.31 #1 Thu Sep 15 12:11:20 CEST 2005 i686 GNU/Linux Regards Rob Op di, 14-02-2006 te 14:44 +0100, schreef Rob Verduijn: > Hi there, > > Many thanx for the example, I got it to work. > > This is the code I used: > > --Start--> > #!/usr/bin/perl > use warnings; > use strict; > > use Net::SSH2; > > my $ssh2 = Net::SSH2->new(); > > print "connect fail\n" unless ($ssh2->connect('testbox')); > print "password fail\n" unless > ($ssh2->auth_keyboard('root','*******')); > > my $chan=$ssh2->channel(); > $chan->shell(); > print $chan "uname -a\n"; > print "LINE : $_" while <$chan>; > print $chan "who\n"; > print "LINE : $_" while <$chan>; > $chan->close; > <--end-- > > > and the output: > --start--> > LINE : Linux testbox 2.6.5-7.111.19-smp #1 SMP Fri Dec 10 15:10:58 UTC > 2004 i686 i686 i386 GNU/Linux > LINE : root pts/0 Feb 14 14:33 (robspc) > <--end-- > > As you can see I can push more than one command to a channel after I > read from the channel. > Don't know why this isn't working for you, if you want to know what > version libs I use let me know which ones you want hear about. > > Thanx > Rob > > > > > > Op ma, 13-02-2006 te 09:39 -0500, schreef Bryan Bueter: > > The best I could come up with is this: > > > > --- snip ---> > > use Net::SSH2; > > > > my $ssh2 = Net::SSH2->new(); > > $ssh2->connect("127.0.0.1"); > > $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; > > print "\n"; > > > > my $chan = $ssh2->channel(); > > $chan->shell(); > > > > print $chan "uptime\n"; > > print $chan "who\n"; > > print "LINE: $_" while <$chan>; > > <--- end --- > > > > The problem is that once you read from the channel, you no longer seem to > > be able to interact with it. So in the above code, you will see your > > uptime and who output, but in the following, all you see is your uptime > > output: > > > > --- snip ---> > > print $chan "uptime\n"; > > print "LINE: $_" while <$chan>; > > > > print "LINE: $_" while <$chan>; > > print $chan "who\n"; > > <--- end --- > > > > I suppose this is a bug, but its been difficult to get anything more > > meaningfull then "read operations seem funny". And I just havnt had time > > to play with it more. > > > > I hope this gets you further then you were before. > > > > > > Bryan > > http://www.sourceforge.net/projects/rover > > > > > Hi everyone, > > > > > > I'm trying to get Net::SSH2 to work but I'm kinda stuk after the > > > connection is made. > > > > > > Could anyone provide an example on how to set up a connection, give a > > > remote command, and then read the output of that command(either stdout > > > or stderr) > > > > > > I would also apreciate an example of the use of chan->shell(); on how to > > > put several commands into that one and how to read the output of those > > > commands (stderr and stdout again) > > > > > > Thanx > > > Rob > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > > > files > > > for problems? Stop! Download the new AJAX search engine that makes > > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > > > _______________________________________________ > > > Ssh-sftp-perl-users mailing list > > > Ssh...@li... > > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > > _______________________________________________ > > Ssh-sftp-perl-users mailing list > > Ssh...@li... > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Rob V. <rob...@br...> - 2006-02-14 13:45:55
|
Hi there, Many thanx for the example, I got it to work. This is the code I used: --Start--> #!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); print "connect fail\n" unless ($ssh2->connect('testbox')); print "password fail\n" unless ($ssh2->auth_keyboard('root','*******')); my $chan=$ssh2->channel(); $chan->shell(); print $chan "uname -a\n"; print "LINE : $_" while <$chan>; print $chan "who\n"; print "LINE : $_" while <$chan>; $chan->close; <--end-- and the output: --start--> LINE : Linux testbox 2.6.5-7.111.19-smp #1 SMP Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386 GNU/Linux LINE : root pts/0 Feb 14 14:33 (robspc) <--end-- As you can see I can push more than one command to a channel after I read from the channel. Don't know why this isn't working for you, if you want to know what version libs I use let me know which ones you want hear about. Thanx Rob Op ma, 13-02-2006 te 09:39 -0500, schreef Bryan Bueter: > The best I could come up with is this: > > --- snip ---> > use Net::SSH2; > > my $ssh2 = Net::SSH2->new(); > $ssh2->connect("127.0.0.1"); > $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; > print "\n"; > > my $chan = $ssh2->channel(); > $chan->shell(); > > print $chan "uptime\n"; > print $chan "who\n"; > print "LINE: $_" while <$chan>; > <--- end --- > > The problem is that once you read from the channel, you no longer seem to > be able to interact with it. So in the above code, you will see your > uptime and who output, but in the following, all you see is your uptime > output: > > --- snip ---> > print $chan "uptime\n"; > print "LINE: $_" while <$chan>; > > print "LINE: $_" while <$chan>; > print $chan "who\n"; > <--- end --- > > I suppose this is a bug, but its been difficult to get anything more > meaningfull then "read operations seem funny". And I just havnt had time > to play with it more. > > I hope this gets you further then you were before. > > > Bryan > http://www.sourceforge.net/projects/rover > > > Hi everyone, > > > > I'm trying to get Net::SSH2 to work but I'm kinda stuk after the > > connection is made. > > > > Could anyone provide an example on how to set up a connection, give a > > remote command, and then read the output of that command(either stdout > > or stderr) > > > > I would also apreciate an example of the use of chan->shell(); on how to > > put several commands into that one and how to read the output of those > > commands (stderr and stdout again) > > > > Thanx > > Rob > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > > files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > > _______________________________________________ > > Ssh-sftp-perl-users mailing list > > Ssh...@li... > > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Rutger O. <ov...@us...> - 2006-02-13 20:36:46
|
BB> The problem is that once you read from the channel, you no longer seem to BB> be able to interact with it. So in the above code, you will see your BB> uptime and who output, but in the following, all you see is your uptime BB> output: Have you tried $chan->blocking(1); after the $chan->shell; call? |
From: Bryan B. <br...@bu...> - 2006-02-13 19:40:08
|
The best I could come up with is this: --- snip ---> use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect("127.0.0.1"); $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; print "\n"; my $chan = $ssh2->channel(); $chan->shell(); print $chan "uptime\n"; print $chan "who\n"; print "LINE: $_" while <$chan>; <--- end --- The problem is that once you read from the channel, you no longer seem to be able to interact with it. So in the above code, you will see your uptime and who output, but in the following, all you see is your uptime output: --- snip ---> print $chan "uptime\n"; print "LINE: $_" while <$chan>; print "LINE: $_" while <$chan>; print $chan "who\n"; <--- end --- I suppose this is a bug, but its been difficult to get anything more meaningfull then "read operations seem funny". And I just havnt had time to play with it more. I hope this gets you further then you were before. Bryan http://www.sourceforge.net/projects/rover > Hi everyone, > > I'm trying to get Net::SSH2 to work but I'm kinda stuk after the > connection is made. > > Could anyone provide an example on how to set up a connection, give a > remote command, and then read the output of that command(either stdout > or stderr) > > I would also apreciate an example of the use of chan->shell(); on how to > put several commands into that one and how to read the output of those > commands (stderr and stdout again) > > Thanx > Rob > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: Rob V. <rob...@br...> - 2006-02-13 13:52:34
|
Hi everyone, I'm trying to get Net::SSH2 to work but I'm kinda stuk after the connection is made. Could anyone provide an example on how to set up a connection, give a remote command, and then read the output of that command(either stdout or stderr) I would also apreciate an example of the use of chan->shell(); on how to put several commands into that one and how to read the output of those commands (stderr and stdout again) Thanx Rob |
From: Rutger O. <ov...@us...> - 2006-02-11 16:18:33
|
I've been trying out Net SSH2: http://search.cpan.org/~dbrobins/Net-SSH2-0.06/ I installed: openssl-0.9.8a.tar.gz libssh2-0.12.tar.gz But scp_get does not work on files > 25k or so. For a 2k file, it works, but larger files receive a segmentation fault. scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. Any hints on why these fail? #-- my $ssh2 = Net::SSH2->new(); $ssh2->connect("shell.sourceforge.net"); $ssh2->auth_publickey(...); $ssh2->scp_get('/home/../file', '/home/../file'); #-- When I strace the script on scp_get, I receive: send(3, ",\27\331\264\26\v\f\222Q\34\311\274\331>\256\'\337$Sw\361"..., 52, 0x4000) = 52 fcntl64(3, F_SETFL, O_RDONLY) = 0 getpid() = 10697 getpid() = 10697 send(3, "V\277\10&k\350>\231\262\360e]\204\226\245V\272\373\305"..., 52, 0x4000) = 52 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ I was connected to shell.sourceforge.net which advertises SSH-1.99-OpenSSH_3.6.1p2. Transferring the file with normal command line "scp" works. |
From: Yishay W. <yis...@ho...> - 2006-02-08 08:10:22
|
Here's what I found by searching your error message in google: " Revision history for Net::SSH::Perl 1.28 2005.03.17 - Patch to skip warning messages emitted by F-Secure sshd before the SSH signature (Neal Ley). - Fix for "Can't locate object method "blocking" via package "IO::Handle"" error (rt.cpan.org #11674, "Dan"). " So it looks like you need to upgrade your Net::SSH::Perl to revision 1.28 (checout CPAN faq if you don't know how). You can find out your currently installed Net::SSH::Perl version number with this one liner: perl -MNet::SSH::Perl -e'print "$Net::SSH::Perl::VERSION\n";' Hope this helps, Yishay >From: Eran Kaufman <era...@gm...> >To: ssh...@li... >Subject: [Ssh-sftp-perl-users] beginners question >Date: Mon, 6 Feb 2006 17:10:46 +0200 > >hi, >trying to run simple ssh command, just to see if module is working for me, >but i receive error i can't understand >here's the short script: > >#!/usr/bin/perl > >$host = "10.106.135.196"; >$user = "user"; >$pass = "password"; >$cmd = "ls"; > >use Net::SSH::Perl; >my $ssh = Net::SSH::Perl->new($host); >$ssh->login($user, $pass); >my($stdout, $stderr, $exit) = $ssh->cmd($cmd); > >print ("$stdout\n"); >print ("$stderr\n"); >print ("$exit\n"); > >the error i receive is: > > >perl test_ssh_100.pl >Can't locate object method "blocking" via package "IO::Handle" at >C:/PXPerl/site/lib/Net/SSH/Perl.pm line 212, <GEN0> line 1. > >Exit code: 9 Time: 0.411 > >can someone assist? > >many thanks, > >Eran |
From: Sander P. <San...@da...> - 2006-02-06 19:35:22
|
All, Our device has a few commands that require inactive input (name and password). It is my understanding I should use the $ssh->shell method to switch to interactive mode but this is a bit beyond me Perl wise. Does anyone have an example of how you wait for a prompt and then provide an answer? I googled but didn't find anything useful. Of course the method 'shell' is also part of 'secure shell' so there are a lot of irrelevant hits to wade through :) I could switch to Net::telnet and modify the prompt but I'd rather learn how to do this with net::ssh::perl. Thanks, Sander |
From: hugues <Hug...@af...> - 2006-02-06 19:26:23
|
>>>>> "David" =3D=3D David Robins <dbr...@cp...> writes: David> On Friday February 3, 2006 00:51, hugues wrote: >> I just wanted to know if there were some fundamental reason why your >> module actually requires perl 5.8 or if there might be some hope to >> make it run under perl 5.6 too ? David> Nothing particular, just the convenience of not having to jump t= hrough hoops=20 David> and include cruft for compatibility. David> However, I am aware there are a lot of perl 5.6 installations ou= t there (the=20 David> last place I worked still used it; they brought in a contractor = to help with=20 David> upgrading to 5.8 but I don't think they actually did upgrade), a= nd I'm=20 David> willing to make Net::SSH2 work with 5.6, especially if met halfw= ay by someone=20 David> such as yourself helping with testing/changes. >> I've been trying just the obvious things, i.e removing all 'use 5.00= 8' >> in Makefile.PL and all the .pm files, and adding a typemap entry for >> 'const char *' as it is defined in the default one for perl5.8 but n= ot >> for perl5.6. >>=20 >> With that mods, i managed to compile the stuff, but got stuck there:= =20 >>=20 >> root-w2# prove -v -b t/Net-SSH2.t=20=20 David> ... >> ok 8 - API date yyyymmddhhmm=20 >> event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396.=20 David> I searched and found something that looks relevant: David> http://www.mail-archive.com/pe...@pe.../msg00982.html David> Looks like 5.6 doesn't like "AV *" in an XS signature and requir= es it be typed=20 David> as an SV * and then checked/cast (a typemap entry might work the= re too; it=20 David> would be nice if the entries added can be 5.6-only (to keep the = 5.8 path=20 David> cleaner), which will probably require two typemap files). Hi David, I've started investigating as promised, and locally modified the prototype for the net_ss__poll() function in the SSH2.xs file as advised in http://www.mail-archive.com/pe...@pe.../msg00982.html (well hopefully ;-) Here are the diffs: --- SSH2.xs.orig Wed Nov 30 04:54:08 2005 +++ SSH2.xs Mon Feb 6 20:00:57 2006 @@ -964,20 +964,23 @@ RETVAL =20 void -net_ss__poll(SSH2* ss, int timeout, AV* event) +net_ss__poll(SSH2* ss, int timeout, SV* event) PREINIT: LIBSSH2_POLLFD* pollfd; int i, count, changed; CODE: + if (! (SvRV(event) && SvTYPE(SvRV(event)) =3D=3D SVt_PVAV)) + croak("%s::poll: reference to an array expected", class); + AV* av_event =3D (AV *) SvRV(event); clear_error(ss); - count =3D av_len(event) + 1; + count =3D av_len(av_event) + 1; debug("%s::poll: timeout =3D %d, array[%d]\n", class, timeout, count); if (!(pollfd =3D malloc(sizeof(LIBSSH2_POLLFD) * count))) { set_error(ss, 0, "out of memory allocating pollfd structures"); XSRETURN_EMPTY; } for (i =3D 0; i < count; ++i) { - SV* sv =3D *av_fetch(event, i, 0/*lval*/), ** handle, ** events; + SV* sv =3D *av_fetch(av_event, i, 0/*lval*/), ** handle, ** events; HV* hv; =20 if (!SvROK(sv) || SvTYPE(SvRV(sv)) !=3D SVt_PVHV) @@ -1027,7 +1030,7 @@ XSRETURN_EMPTY; =20 for (i =3D 0; i < count; ++i) { - HV* hv =3D (HV*)SvRV(*av_fetch(event, i, 0/*lval*/)); + HV* hv =3D (HV*)SvRV(*av_fetch(av_event, i, 0/*lval*/)); hv_store(hv, "revents", 7, newSViv(pollfd[i].revents), 0/*hash*/); debug("- [%d] revents %d\n", i, pollfd[i].revents); } With this change, the module now compile and apparently passes the same tests as in perl5.8. =20 I've also checked that the changes still pass on my perl5.7. I've been stuck though at connect() time when running the t/Net-SSH2.t test file. It seems to me that there might be a typo here as the test is done via: ok($ssh2->connect($host), "connect to $host"); but i beleive that: ok($ssh2->connect($host) =3D=3D 0, "connect to $host"); would be more appropriate, at least that's the impression i get when reading both the module code and the libssh2 API documentation that says:=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - Name libssh2_session_startup =E2=80=94 start ssh2 on a socket - Synopsis #include <libssh2.h> int libssh2_session_startup(LIBSSH2_SESSION *session, int socket); Description This function starts the SSH2 protocol on an existing socket, and associates it with session.=20 On success, 0 is returned. On error, one of the errorcodes below is returned indicating the specific error that occurred.=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D So i understand that $ssh2->connect() will return 0 when succeeding. Anyway when applying the following change, i can get the tests to proceed up to the authentication phase (i will stop here for today): --- t/Net-SSH2.t.orig Wed Nov 30 04:30:52 2005 +++ t/Net-SSH2.t Mon Feb 6 20:16:14 2006 @@ -54,7 +54,7 @@ } SKIP: { # SKIP-server skip '- no server daemon available', 61 unless $host; -ok($ssh2->connect($host), "connect to $host"); +ok($ssh2->connect($host) =3D=3D 0, "connect to $host"); =20 # (8) server methods for my $type(qw(kex hostkey crypt_cs crypt_sc mac_cs mac_sc comp_cs comp_s= c)) { Thanks again for your help. --=20 Hugues Lafarge || Email: Hug...@af... Agence France Presse || Phone: +33 1 40 41 77 15 4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Steven H. <hes...@ya...> - 2006-02-06 19:18:40
|
https://rt.cpan.org/Public/Bug/Display.html?id=11674 I had the same problem and was able to resolve by adding the following line to perl.pm: use IO::Socket; --- Eran Kaufman <era...@gm...> wrote: > hi, > trying to run simple ssh command, just to see if > module is working for me, > but i receive error i can't understand > here's the short script: > > #!/usr/bin/perl > > $host = "10.106.135.196"; > $user = "user"; > $pass = "password"; > $cmd = "ls"; > > use Net::SSH::Perl; > my $ssh = Net::SSH::Perl->new($host); > $ssh->login($user, $pass); > my($stdout, $stderr, $exit) = $ssh->cmd($cmd); > > print ("$stdout\n"); > print ("$stderr\n"); > print ("$exit\n"); > > the error i receive is: > > >perl test_ssh_100.pl > Can't locate object method "blocking" via package > "IO::Handle" at > C:/PXPerl/site/lib/Net/SSH/Perl.pm line 212, <GEN0> > line 1. > >Exit code: 9 Time: 0.411 > > can someone assist? > > many thanks, > > Eran > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |