ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 25)
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: Michael M. <mm...@gm...> - 2006-02-06 15:34:14
|
It's a bug in the version of the module that you get when you retrieve the module via cpan. Not sure why it doesn't get updated there. On 2/6/06, 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 =3D "10.106.135.196"; > $user =3D "user"; > $pass =3D "password"; > $cmd =3D "ls"; > > use Net::SSH::Perl; > my $ssh =3D Net::SSH::Perl->new($host); > $ssh->login($user, $pass); > my($stdout, $stderr, $exit) =3D $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: Eran K. <era...@gm...> - 2006-02-06 15:10:53
|
aGksCnRyeWluZyB0byBydW4gc2ltcGxlIHNzaCBjb21tYW5kLCBqdXN0IHRvIHNlZSBpZiBtb2R1 bGUgaXMgd29ya2luZyBmb3IgbWUsCmJ1dCBpIHJlY2VpdmUgZXJyb3IgaSBjYW4ndCB1bmRlcnN0 YW5kCmhlcmUncyB0aGUgc2hvcnQgc2NyaXB0OgoKIyEvdXNyL2Jpbi9wZXJsCgokaG9zdCA9ICIx MC4xMDYuMTM1LjE5NiI7CiR1c2VyID0gInVzZXIiOwokcGFzcyA9ICJwYXNzd29yZCI7CiRjbWQg PSAibHMiOwoKdXNlIE5ldDo6U1NIOjpQZXJsOwpteSAkc3NoID0gTmV0OjpTU0g6OlBlcmwtPm5l dygkaG9zdCk7CiRzc2gtPmxvZ2luKCR1c2VyLCAkcGFzcyk7Cm15KCRzdGRvdXQsICRzdGRlcnIs ICRleGl0KSA9ICRzc2gtPmNtZCgkY21kKTsKCnByaW50ICgiJHN0ZG91dFxuIik7CnByaW50ICgi JHN0ZGVyclxuIik7CnByaW50ICgiJGV4aXRcbiIpOwoKdGhlIGVycm9yIGkgcmVjZWl2ZSBpczoK Cj5wZXJsIHRlc3Rfc3NoXzEwMC5wbApDYW4ndCBsb2NhdGUgb2JqZWN0IG1ldGhvZCAiYmxvY2tp bmciIHZpYSBwYWNrYWdlICJJTzo6SGFuZGxlIiBhdApDOi9QWFBlcmwvc2l0ZS9saWIvTmV0L1NT SC9QZXJsLnBtIGxpbmUgMjEyLCA8R0VOMD4gbGluZSAxLgo+RXhpdCBjb2RlOiA5ICAgIFRpbWU6 IDAuNDExCgpjYW4gc29tZW9uZSBhc3Npc3Q/CgptYW55IHRoYW5rcywKCkVyYW4K |
From: hugues <Hug...@af...> - 2006-02-06 10:11:56
|
>>>>> "David" == 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 through hoops David> and include cruft for compatibility. David> However, I am aware there are a lot of perl 5.6 installations out there (the David> last place I worked still used it; they brought in a contractor to help with David> upgrading to 5.8 but I don't think they actually did upgrade), and I'm David> willing to make Net::SSH2 work with 5.6, especially if met halfway by someone David> such as yourself helping with testing/changes. I'm glad to hear that, and will provide any help i'm able to. >> I've been trying just the obvious things, i.e removing all 'use 5.008' >> 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 not >> for perl5.6. >> >> With that mods, i managed to compile the stuff, but got stuck there: >> >> root-w2# prove -v -b t/Net-SSH2.t David> ... >> ok 8 - API date yyyymmddhhmm >> event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. 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 requires it be typed David> as an SV * and then checked/cast (a typemap entry might work there too; it David> would be nice if the entries added can be 5.6-only (to keep the 5.8 path David> cleaner), which will probably require two typemap files). Thanks, i'll follow that path and let you know where it led me. >> ok 9 - banner is SSH-2.0-libssh2_0.12 >> # Looks like you planned 72 tests but only ran 9. >> # Looks like your test died just after 9. >> dubious >> Test returned status 255 (wstat 65280, 0xff00) >> DIED. FAILED tests 10-72 David> Looks like it crashed there; if you check the core file you can probably David> determine what happened using a debugger such as gdb or dbx by looking at the David> stack trace and variables. >> Before diving any further, i thought i might ask you if there was hope >> along that path, or if i'd better put all my strength in getting perl 5.8 >> installed on my productions servers ... David> Sure, there is hope. I don't have any 5.6 installations myself, though, so David> I'll need you (and any others on the list that are interested) to test and David> provide patches for 5.6 compatibility. If you're able to do that, great, if David> not, go with the upgrade if you can :). I'll sure be glad to help at least by testing and maybe even with providing patches if i can manage that. >> Thanks anyway for both maintaining Net::SSH::Perl and providing us >> with that new shiny Net::SSH2 module ! David> Glad to contribute, thanks for the feedback. Thank YOU. -- 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: David R. <dbr...@cp...> - 2006-02-03 09:44:30
|
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 ? Nothing particular, just the convenience of not having to jump through hoops and include cruft for compatibility. However, I am aware there are a lot of perl 5.6 installations out there (the last place I worked still used it; they brought in a contractor to help with upgrading to 5.8 but I don't think they actually did upgrade), and I'm willing to make Net::SSH2 work with 5.6, especially if met halfway by someone such as yourself helping with testing/changes. > I've been trying just the obvious things, i.e removing all 'use 5.008' > 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 not > for perl5.6. > > With that mods, i managed to compile the stuff, but got stuck there: > > root-w2# prove -v -b t/Net-SSH2.t ... > ok 8 - API date yyyymmddhhmm > event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. I searched and found something that looks relevant: http://www.mail-archive.com/pe...@pe.../msg00982.html Looks like 5.6 doesn't like "AV *" in an XS signature and requires it be typed as an SV * and then checked/cast (a typemap entry might work there too; it would be nice if the entries added can be 5.6-only (to keep the 5.8 path cleaner), which will probably require two typemap files). > ok 9 - banner is SSH-2.0-libssh2_0.12 > # Looks like you planned 72 tests but only ran 9. > # Looks like your test died just after 9. > dubious > Test returned status 255 (wstat 65280, 0xff00) > DIED. FAILED tests 10-72 Looks like it crashed there; if you check the core file you can probably determine what happened using a debugger such as gdb or dbx by looking at the stack trace and variables. > Before diving any further, i thought i might ask you if there was hope > along that path, or if i'd better put all my strength in getting perl 5.8 > installed on my productions servers ... Sure, there is hope. I don't have any 5.6 installations myself, though, so I'll need you (and any others on the list that are interested) to test and provide patches for 5.6 compatibility. If you're able to do that, great, if not, go with the upgrade if you can :). > Thanks anyway for both maintaining Net::SSH::Perl and providing us > with that new shiny Net::SSH2 module ! Glad to contribute, thanks for the feedback. -- Dave Isa. 40:31 |
From: hugues <Hug...@af...> - 2006-02-03 08:51:20
|
Hello David, I've been having a look at your new Net::SSH2 module and would very much like to use that in place of Net::SSH::Perl in my application. My problem is that the production servers that will ultimately have to run the application still run under perl 5.6.0, and that probably won't change in the near future :-(( 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 ? I've been trying just the obvious things, i.e removing all 'use 5.008' 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 not for perl5.6. With that mods, i managed to compile the stuff, but got stuck there: root-w2# prove -v -b t/Net-SSH2.t t/Net-SSH2....1..72 ok 1 - use Net::SSH2; ok 2 - new session isa Net::SSH2 ok 3 - error state clear ok 4 - set banner ok 5 - LIBSSH2_* constants ok 6 - libSSH2 version 0.12 > 0.11 ok 7 - list version match ok 8 - API date yyyymmddhhmm event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. ok 9 - banner is SSH-2.0-libssh2_0.12 # Looks like you planned 72 tests but only ran 9. # Looks like your test died just after 9. dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 10-72 Failed 63/72 tests, 12.50% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- t/Net-SSH2.t 255 65280 72 126 175.00% 10-72 Failed 1/1 test scripts, 0.00% okay. 63/72 subtests failed, 12.50% okay. Before diving any further, i thought i might ask you if there was hope along that path, or if i'd better put all my strength in getting perl 5.8 installed on my productions servers ... Thanks anyway for both maintaining Net::SSH::Perl and providing us with that new shiny Net::SSH2 module ! -- 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: David R. <dbr...@cp...> - 2006-02-03 04:35:28
|
On Thursday February 2, 2006 11:55, Eric Langheinrich wrote: > > > > use Net::SSH::Perl; > > my $ssh = Net::SSH::Perl->new('10.x.x.x', options > > => ['Port 22']); > > $ssh->login('USERNAME', 'PASSWORD'); > > my($stdout, $stderr, $exit) = $ssh->cmd('sh ver'); > > print $stdout; > > > > ERROR: > > Can't locate Math/GMP.pm in @INC (@INC contains: > > You need to install Math::GMP before you install Net::SSH::Perl ... > Also looks like your Net::SSH::Perl isn't properly installed. Let me add that I'm not sure Net::SSH::Perl works on Windows at all; you may have more luck with Net::SSH2. -- Dave Isa. 40:31 |
From: Eric L. <net...@er...> - 2006-02-02 19:55:20
|
> > use Net::SSH::Perl; > my $ssh = Net::SSH::Perl->new('10.x.x.x', options > => ['Port 22']); > $ssh->login('USERNAME', 'PASSWORD'); > my($stdout, $stderr, $exit) = $ssh->cmd('sh ver'); > print $stdout; > > ERROR: > Can't locate Math/GMP.pm in @INC (@INC contains: You need to install Math::GMP before you install Net::SSH::Perl > C:/Perl/lib C:/Perl/site/lib .) > at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.pm line > 7, <GEN0> line 1. > BEGIN failed--compilation aborted at > C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.p > m line 7, <GEN0> line 1. > Compilation failed in require at > C:/Perl/site/lib/Net/SSH/Perl/Util.pm line 56, > <GEN0> line 1. > BEGIN failed--compilation aborted at > C:/Perl/site/lib/Net/SSH/Perl/Key/RSA1.pm l > ine 6, <GEN0> line 1. > Compilation failed in require at > C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line 13, > <GEN0> line 1. > BEGIN failed--compilation aborted at > C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line > 13, <GEN0> line 1. > Compilation failed in require at > C:/Perl/site/lib/Net/SSH/Perl.pm line 55, <GEN0 > > line 1. Also looks like your Net::SSH::Perl isn't properly installed. |
From: Steven H. <hes...@ya...> - 2006-02-02 19:50:53
|
I'm a newbie so have mercy on me! Any guidance would be appreciated (BTW-I'm googled out on this issue). :P I would like to know how to make a simple SSH (v.1 3DES) conection to a Cisco switch. I am running windows XP with ActivePerl v5.8.7. I have installed 'Net-SSH-Perl' version 1.23_01. Are there any other packages/modules that I need to install? Incorrect code?? I am currently using Repositories: [1] ActiveState Package Repository [2] soulcage CODE: use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new('10.x.x.x', options => ['Port 22']); $ssh->login('USERNAME', 'PASSWORD'); my($stdout, $stderr, $exit) = $ssh->cmd('sh ver'); print $stdout; ERROR: Can't locate Math/GMP.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.pm line 7, <GEN0> line 1. BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.p m line 7, <GEN0> line 1. Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Util.pm line 56, <GEN0> line 1. BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Key/RSA1.pm l ine 6, <GEN0> line 1. Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line 13, <GEN0> line 1. BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line 13, <GEN0> line 1. Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl.pm line 55, <GEN0 > line 1. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Bryan B. <br...@bu...> - 2006-01-23 14:19:35
|
> > Because it's not a real file. It's a stream multiplexed over an encrypted > socket connection formatted by the ssh protocol. If you read the raw > socket > you'd get ssh frames and encrypted data. > I understand the logistics of the SSH connection, and that writing directly to the socket is not what i'm suggesting. I'm not a perl hacker so i'm sure its more complicated then I think, but I what I had in mind was, since you already create a tied filehandle that one can use to send IO to after a shell channel is created, why not create a real file handle. I'll take your previous response as, its way more complicated then I think, and consider it out of scope. Unless that explanation somehow makes a difference. > > You don't exec on top of shell - exec is like exec(2) and doesn't let you > run > subsequent operations. When you have a shell channel you can send it > commands and read back the responses using the standard I/O commands in > Net::SSH2::Channel (or with filehandle ops using the tie). > Yeah, I was having problems actually using a shell channel, i was trying anything. So noted. >> An example might be handy, and/or some further documentation. > > If you get a chance to write one please submit it for inclusion. > > Thanks, > > -- > Dave > Isa. 40:31 I'll let you know about an example/documentation. I'll be messing with it over the next week or so as I have free time, If I come up with something I'll submit it for your review. Thanks, Bryan http://sourceforge.net/projects/rover |
From: David R. <dbr...@cp...> - 2006-01-21 02:44:50
|
On Friday January 20, 2006 09:22, Bryan Bueter wrote: > > > > Ah, then there's the problem. Fileno tries to get a real Unix filehandle > > out > > of the object; since it isn't a real Unix file, you won't get one. > > > > Maybe something can be worked out with pipes so that it really is a handle > > (create a pipe, send the channel data to one end, give expect the other > > end) > > but it's beyond the scope of the current implementation. > > Ok, forgive me if my ignorance misses something here. > > Why not just implement channel as a real filehandle? You would still do > everything as is, but only now you could create a shell, then print things > directly to and read things directly from it. Because it's not a real file. It's a stream multiplexed over an encrypted socket connection formatted by the ssh protocol. If you read the raw socket you'd get ssh frames and encrypted data. > Which begets the question: What AM I to do with a shell created by > $chan->shell() ? Do I have to keep polling this to know when I can write > to it? I havnt been able to do much with this other then print out the > first couple of lines after it connects. Printing directly to it and/or > execing on top of shell doesnt seem to produce any more output then that. You don't exec on top of shell - exec is like exec(2) and doesn't let you run subsequent operations. When you have a shell channel you can send it commands and read back the responses using the standard I/O commands in Net::SSH2::Channel (or with filehandle ops using the tie). > An example might be handy, and/or some further documentation. If you get a chance to write one please submit it for inclusion. Thanks, -- Dave Isa. 40:31 |
From: Rick R. <ric...@we...> - 2006-01-20 22:53:41
|
Hi, I'm in the process of moving some scripts from an old Redhat Enterprise Linux 3.0 server to a more modern CentOS 4.2 server. I used the CPAN module to install Net::SFTP (along with Net::SSH::Perl and yada yada yada), and unfortunately, i cannot get my scripts to work. This particular perl script runs by a specific user who has ssh keys set up to automatically log in to a remote server to do file transfers. I have verified that I can use command line ssh and sftp to connect to the remote server. However, when I attempt to use my perl script to handle the work, it errors while making the connection. Basically, the following line: my $sftp = Net::SFTP->new($hostname) or error_exit("Unable to connect to $hostname via Net::SFTP"); causes the script to hang for a minute or so and then results in the following error message: Connection closed by remote host. at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/AuthMgr.pm line 43 Can anyone help me? Thanks. Rick |
From: Bryan B. <br...@bu...> - 2006-01-20 20:22:06
|
> > Ah, then there's the problem. Fileno tries to get a real Unix filehandle > out > of the object; since it isn't a real Unix file, you won't get one. > > Maybe something can be worked out with pipes so that it really is a handle > (create a pipe, send the channel data to one end, give expect the other > end) > but it's beyond the scope of the current implementation. > > -- > Dave > Isa. 40:31 Ok, forgive me if my ignorance misses something here. Why not just implement channel as a real filehandle? You would still do everything as is, but only now you could create a shell, then print things directly to and read things directly from it. Which begets the question: What AM I to do with a shell created by $chan->shell() ? Do I have to keep polling this to know when I can write to it? I havnt been able to do much with this other then print out the first couple of lines after it connects. Printing directly to it and/or execing on top of shell doesnt seem to produce any more output then that. An example might be handy, and/or some further documentation. Thanks. Bryan http://sourceforge.net/projects/rover |
From: David R. <dbr...@cp...> - 2006-01-20 17:24:08
|
On Friday January 20, 2006 03:52, Bryan Bueter wrote: > >> I dont fully understand channels, but from what I remember with > >> Net::SSH::Perl, a new channel had to be created every time you sent a > >> command. But now there is a Net::SSH2::Channel->shell() function, > >> perhaps > >> there is a way to launch a shell on a channel and interact with that? > > > > There is. The shell() function just makes the channel a shell channel, > > and you can send commands to it. > > Does this act like a normal shell? Primarily does it just exec shell and > pass IO back and forth, or is it interpreted somehow? I think it does act like a normal shell; you'll probably have to test it though. I'm not sure what the ssh spec says regarding the actual shell at the other end. > >> I see Net::SSH2::Channel is itself a tied filehandle, but attempts to > >> directly manipulate that dont result in what I expected. > > > > In what way? If you can give details I'll try to fix them. > > With this snipit of code: > > -- snip --> > use Net::SSH2; > use Expect; > > my $ssh2 = Net::SSH2->new(); > $ssh2->connect("127.0.0.1"); > $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; > > my $chan = $ssh2->channel(); > $chan->shell(); > > my $exp_obj = Expect->exp_init( $chan ); > <-- end -- > > Returns the following when I run the script: > $ ./test.pl > [user username] > Password: ERROR: cannot find method `FILENO' in class Expect at ./test3.pl > line 13 > > Line 13 is the expect init line. Maybe its an expect bug, but I dont > think so. I've been able to open expect on raw sockets before. So i > think it has something to do with the way channel() sets itself up. Ah, then there's the problem. Fileno tries to get a real Unix filehandle out of the object; since it isn't a real Unix file, you won't get one. Maybe something can be worked out with pipes so that it really is a handle (create a pipe, send the channel data to one end, give expect the other end) but it's beyond the scope of the current implementation. -- Dave Isa. 40:31 |
From: Bryan B. <br...@bu...> - 2006-01-20 14:50:59
|
>> I dont fully understand channels, but from what I remember with >> Net::SSH::Perl, a new channel had to be created every time you sent a >> command. But now there is a Net::SSH2::Channel->shell() function, >> perhaps >> there is a way to launch a shell on a channel and interact with that? > > There is. The shell() function just makes the channel a shell channel, > and you can send commands to it. > Does this act like a normal shell? Primarily does it just exec shell and pass IO back and forth, or is it interpreted somehow? >> I see Net::SSH2::Channel is itself a tied filehandle, but attempts to >> directly manipulate that dont result in what I expected. > > In what way? If you can give details I'll try to fix them. > > -- > Dave > Isa. 40:31 > With this snipit of code: -- snip --> use Net::SSH2; use Expect; my $ssh2 = Net::SSH2->new(); $ssh2->connect("127.0.0.1"); $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; my $chan = $ssh2->channel(); $chan->shell(); my $exp_obj = Expect->exp_init( $chan ); <-- end -- Returns the following when I run the script: $ ./test.pl [user username] Password: ERROR: cannot find method `FILENO' in class Expect at ./test3.pl line 13 Line 13 is the expect init line. Maybe its an expect bug, but I dont think so. I've been able to open expect on raw sockets before. So i think it has something to do with the way channel() sets itself up. Thanks. Bryan http://sourceforge.net/projects/rove |
From: David R. <dbr...@cp...> - 2006-01-20 03:17:00
|
On Thursday January 19, 2006 09:02, Bryan Bueter wrote: > Greetings, Some time ago I used Net::SSH::Perl, but gave it up for Expect. > Now I'm back looking at Net::SSH2, but would still like to put expect on > top of it. I want to use Net::SSH2 because it appears thread safe, while > spawining a process with a tty in expect for perl is not. > > What I want to do is create a Net::SSH2 object, connect, get an > interactive shell, and interact with it via a file handle. Then i can use > expect on top of that and do whatever I like. > > I dont fully understand channels, but from what I remember with > Net::SSH::Perl, a new channel had to be created every time you sent a > command. But now there is a Net::SSH2::Channel->shell() function, perhaps > there is a way to launch a shell on a channel and interact with that? There is. The shell() function just makes the channel a shell channel, and you can send commands to it. > I see Net::SSH2::Channel is itself a tied filehandle, but attempts to > directly manipulate that dont result in what I expected. In what way? If you can give details I'll try to fix them. -- Dave Isa. 40:31 |
From: U235Sentinel <u23...@gm...> - 2006-01-19 23:08:16
|
Has anyone been successful in resolving this with passwd? I've tried this against AIX 5.3, Sles 8 and 9, Solaris 8 and 9 servers. I've had a variety of interesting experiences and would love to make this work. :-) I have a couple of code examples I've written to help demonstrate the problem/ possible bug. FYI.. it works just fine IF you don't interact with passwd. If I grab info via ls, cat, or whatever then it works great. I understand there is a Net::SSH2 available and am looking into replacing Net::SSH::Perl with it. I'm soo close to makeing this work. Would be nice to finish what I started= :D Thanks! --------- From: mgt <comeonbaby@mg...> problem of remoteinteract2.pl and remoteinteract.pl 2005-12-08 07:05 --------- Everything is fine rather than executing like passwd, needed be interactive= . Things always get stuck on "channel 1: open confirm rwindow 0 rmax 32768". May somebody tell me how to solve it please? Here are the outputs: user@hostname [eg] # perl remoteinteract2.pl hostname: Reading configuration data /root/.ssh/config hostname: Reading configuration data /etc/ssh_config hostname: Allocated local port 1020. hostname: Connecting to remotehost, port 22. hostname: Remote protocol version 2.0, remote software version OpenSSH_3.5p1 FreeBSD-20030924 hostname: Net::SSH::Perl Version 1.29, protocol version 2.0. hostname: No compat match: OpenSSH_3.5p1 FreeBSD-20030924. hostname: Connection established. hostname: Sent key-exchange init (KEXINIT), wait response. hostname: Algorithms, c->s: 3des-cbc hmac-sha1 none hostname: Algorithms, s->c: 3des-cbc hmac-sha1 none hostname: Entering Diffie-Hellman Group 1 key exchange. hostname: Sent DH public key, waiting for reply. hostname: Received host key, type 'ssh-dss'. hostname: Host 'remotehost' is known and matches the host key. hostname: Computing shared secret key. hostname: Verifying server signature. hostname: Waiting for NEWKEYS message. hostname: Enabling incoming encryption/MAC/compression. hostname: Send NEWKEYS, enable outgoing encryption/MAC/compression. hostname: Sending request for user-authentication service. hostname: Service accepted: ssh-userauth. hostname: Trying empty user-authentication request. hostname: Authentication methods that can continue: publickey,password,keyboard-interactive. hostname: Next method to try is publickey. hostname: Next method to try is password. hostname: Trying password authentication. hostname: Login completed, opening dummy shell channel. hostname: channel 0: new [client-session] hostname: Requesting channel_open for channel 0. hostname: channel 0: open confirm rwindow 0 rmax 32768 hostname: Got channel open confirmation, requesting shell. hostname: Requesting service shell on channel 0. hostname: channel 1: new [client-session] hostname: Requesting channel_open for channel 1. hostname: Entering interactive session. hostname: Sending command: passwd hostname: Requesting service exec on channel 1. hostname: channel 1: open confirm rwindow 0 rmax 32768 |
From: Bryan B. <br...@bu...> - 2006-01-19 20:01:31
|
Greetings, Some time ago I used Net::SSH::Perl, but gave it up for Expect. Now I'm back looking at Net::SSH2, but would still like to put expect on top of it. I want to use Net::SSH2 because it appears thread safe, while spawining a process with a tty in expect for perl is not. What I want to do is create a Net::SSH2 object, connect, get an interactive shell, and interact with it via a file handle. Then i can use expect on top of that and do whatever I like. I dont fully understand channels, but from what I remember with Net::SSH::Perl, a new channel had to be created every time you sent a command. But now there is a Net::SSH2::Channel->shell() function, perhaps there is a way to launch a shell on a channel and interact with that? I see Net::SSH2::Channel is itself a tied filehandle, but attempts to directly manipulate that dont result in what I expected. Thanks. Bryan http://www.sourceforge.net/projects/rover |
From: Jere J. <net...@St...> - 2006-01-13 15:10:22
|
File puts are taking exceptionally long times: 6.6M in 2 sec using system(/usr/bin/scp...) 44 sec using Net::SFTP Protocol: 2 public-key auth Linux to cygwin Gigabit Ethernet I don't seem to have any trouble with authentication times (which is what I see in the archives) even though I don't have Math::BigInt::GMP installed. Will the GMP module affect this, also? (I would just ty it but I have to get my IT dept to install it.) Thanks, -Jere -- |
From: Henrik B. <hbe...@gm...> - 2006-01-09 23:51:31
|
Hi I'm considering using Net:SFTP module in one of my projects. One of my requirements is that I must be able to interface with a SSH server running F-Secure SSH (now rebranded as "Reflection for Secure IT"). I've searched through the mailing lists for any issues related to this but I couldn't find anything. Has anyone tried using the SFTP module or the Net:SSH:Client connecting to a SSH server running F-Secure SSH? thanks, Henrik Bentel |
From: Miky J <mi...@ya...> - 2006-01-09 15:52:27
|
Thanx, eval did the job great for me. I'm quite new with perl so I didn't know eval. --- Rafe Slattery <raf...@iq...> a écrit : > Miky J wrote: > > >Hi, > > > >I'm not the only one to log on some machines and > >sometimes passwords change here. > > > >When I do > >$ssh->login($login, $password); > >with $password='wrong password' > >I'd like my script to make a second attempt with > >$password='good password' > > > >I have tryed > >if ($ssh->login($login, $password)) { ... } > >else { retry to connect } > > > >but it didn't work. > > > >Does anyone know how to do that ? > > > > > > > > > > If I remember correctly, > the ssh lib dies the script after a login attempt > fails... > so you need to wrap the login attempt in an eval and > then try with a new > password if it fails..... > If you search the list archives I'm pretty certain > its there.... > In fact, if memory serves I asked that very question > about 18 months ago :-> > (I did a debug step through the code and found the > die line) > apologies for the piss poor code :-> > > I think you could just put in a second login attempt > where I have the > write_results sub below. > > Rafe > > use Net::SSH::Perl; > eval { > local $SIG{ALRM} = sub { write_results( > $opt{C}, 2, "Timeout > Failure", 1 ) }; > alarm $TIMEOUT; > $ssh = Net::SSH::Perl->new( $host, > options => [ "Debug 1", > "Protocol 2" ] ); > } > || write_results( $opt{C}, 2, "Connection > Failure", 1 ); > eval { $pwd = $ssh->login( $username, > $password ) }; > if ( !$@ ) { > my $cmd = q( uname); > my ( $stdout, $stderr, $exit ) = > $ssh->cmd($cmd); > > # print "host: $stdout\n"; > chomp($stdout); > if ( $stdout eq "Linux" ) { > > $cmd = "ps -ef |grep -i \"$process\" > |grep -v grep |grep > -v process.pl"; > > } > else { > > $cmd = "/usr/ucb/ps -auxww |grep -i > \"$process\" |grep > -v grep |grep -v process.pl"; > > } > ( $stdout, $stderr, $exit ) = > $ssh->cmd($cmd); > > ___________________________________________________________________________ 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: Rafe S. <raf...@iq...> - 2006-01-09 10:56:00
|
Miky J wrote: >Hi, > >I'm not the only one to log on some machines and >sometimes passwords change here. > >When I do >$ssh->login($login, $password); >with $password='wrong password' >I'd like my script to make a second attempt with >$password='good password' > >I have tryed >if ($ssh->login($login, $password)) { ... } >else { retry to connect } > >but it didn't work. > >Does anyone know how to do that ? > > > > If I remember correctly, the ssh lib dies the script after a login attempt fails... so you need to wrap the login attempt in an eval and then try with a new password if it fails..... If you search the list archives I'm pretty certain its there.... In fact, if memory serves I asked that very question about 18 months ago :-> (I did a debug step through the code and found the die line) apologies for the piss poor code :-> I think you could just put in a second login attempt where I have the write_results sub below. Rafe use Net::SSH::Perl; eval { local $SIG{ALRM} = sub { write_results( $opt{C}, 2, "Timeout Failure", 1 ) }; alarm $TIMEOUT; $ssh = Net::SSH::Perl->new( $host, options => [ "Debug 1", "Protocol 2" ] ); } || write_results( $opt{C}, 2, "Connection Failure", 1 ); eval { $pwd = $ssh->login( $username, $password ) }; if ( !$@ ) { my $cmd = q( uname); my ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd); # print "host: $stdout\n"; chomp($stdout); if ( $stdout eq "Linux" ) { $cmd = "ps -ef |grep -i \"$process\" |grep -v grep |grep -v process.pl"; } else { $cmd = "/usr/ucb/ps -auxww |grep -i \"$process\" |grep -v grep |grep -v process.pl"; } ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd); |
From: Miky J <mi...@ya...> - 2006-01-09 10:12:19
|
Hi, I'm not the only one to log on some machines and sometimes passwords change here. When I do $ssh->login($login, $password); with $password='wrong password' I'd like my script to make a second attempt with $password='good password' I have tryed if ($ssh->login($login, $password)) { ... } else { retry to connect } but it didn't work. Does anyone know how to do that ? ___________________________________________________________________________ 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: Miky J <mi...@ya...> - 2006-01-08 11:20:38
|
Thanx, it solved the issue --- elec <ele...@gm...> a écrit : > read the previous threads....you need a to add a > package > > Math::BigInt::GMP > > > perl -MCPAN -e "install Math::BigInt::GMP" > > > On 1/2/06, Miky J <mi...@ya...> wrote: > > > > Hello and happy new year, > > > > I'm trying to automatise a logging script to check > the > > config on many linux machines. > > > > - Some machines use SSH 1 and 2, by default it's > the > > version 1 and > > I have a warning coming from the perl module. > > Argument "ssh-rsa" isn't numeric in numeric eq > (==) at > > > /usr/lib/perl5/site_perl/5.8.6/Net/SSH/Perl/Key/RSA1.pm > > line 94, <FH> line 20. > > > > - By default I'd like to use SSH 2 all the time > but > > it's very slow to log in, more than one minute. > But > > when i do > > $ssh -2 root@the_host > > it's fast. > > > > My Debug > > -------- > > > > $ ./newssh.pl > > Trying to log in > > admin: Reading configuration data > > /home/mikydeb/.ssh/config > > admin: Reading configuration data /etc/ssh_config > > admin: Connecting to the_host, port 22. > > admin: Remote protocol version 1.99, remote > software > > version OpenSSH_3.6.1p2 > > admin: Net::SSH::Perl Version 1.29, protocol > version > > 2.0. > > admin: No compat match: OpenSSH_3.6.1p2. > > admin: Connection established. > > envoi password et loggin : root, the_password > > admin: Sent key-exchange init (KEXINIT), wait > > response. > > admin: Algorithms, c->s: 3des-cbc hmac-sha1 none > > admin: Algorithms, s->c: 3des-cbc hmac-sha1 none > > > > <---25 seconds---> > > > > admin: Entering Diffie-Hellman Group 1 key > exchange. > > admin: Sent DH public key, waiting for reply. > > admin: Received host key, type 'ssh-dss'. > > admin: Host 'the_host' is known and matches the > host > > key. > > admin: Computing shared secret key. > > > > <---25 seconds---> > > > > admin: Verifying server signature. > > > > <---10 seconds---> > > > > admin: Waiting for NEWKEYS message. > > admin: Enabling incoming > encryption/MAC/compression. > > admin: Send NEWKEYS, enable outgoing > > encryption/MAC/compression. > > admin: Sending request for user-authentication > > service. > > admin: Service accepted: ssh-userauth. > > admin: Trying empty user-authentication request. > > admin: Authentication methods that can continue: > > publickey,password,keyboard-interactive. > > admin: Next method to try is publickey. > > admin: Trying pubkey authentication with key file > > '/home/mikydeb/.ssh/id_dsa' > > admin: Authentication methods that can continue: > > publickey,password,keyboard-interactive. > > admin: Next method to try is publickey. > > admin: Next method to try is password. > > admin: Trying password authentication. > > admin: Login completed, opening dummy shell > channel. > > admin: channel 0: new [client-session] > > admin: Requesting channel_open for channel 0. > > admin: channel 0: open confirm rwindow 0 rmax > 32768 > > admin: Got channel open confirmation, requesting > > shell. > > admin: Requesting service shell on channel 0. > > Loggin OK > > admin: channel 1: new [client-session] > > admin: Requesting channel_open for channel 1. > > admin: Entering interactive session. > > admin: Sending command: ps -ef > > admin: Requesting service exec on channel 1. > > admin: channel 1: open confirm rwindow 0 rmax > 32768 > > admin: input_channel_request: rtype exit-status > reply > > 0 > > admin: channel 1: rcvd eof > > admin: channel 1: output open -> drain > > admin: channel 1: rcvd close > > admin: channel 1: input open -> closed > > admin: channel 1: close_read > > admin: channel 1: obuf empty > > admin: channel 1: output drain -> closed > > admin: channel 1: close_write > > admin: channel 1: send close > > admin: channel 1: full closed > > > > > > My script > > --------- > > > > #!/usr/bin/perl -w > > > > my $host="the_host"; > > my $login='root'; > > my $password='the_password'; > > my $commande='ps -ef'; > > > > login($login,$password,$host, $commande); > > > > sub login > > { > > my ($login, $password, $host, $cmd) = @_; > > my $dump = 'dump.txt'; > > open (DUMP, ">>$dump") or die "Impossible d'ouvrir > > le fichier $dump"; > > > > print "Trying to log in\n"; > > # Force version 2 > > my $ssh = Net::SSH::Perl->new($host, > protocol=>'2', > > port=>22, debug=>"true"); > > > > print "Sending password and loggin : $login, > > $password\n"; > > $ssh->login($login, $password); > > print "Loggin OK\n"; > > > > my($resultat, $stderr, $exit) = $ssh->cmd($cmd); > > print DUMP "$host\t$resultat"; > > close DUMP; > > } > > > > > > Do you have any idea of what causes this, is it a > > problem in my script ? or maybe on the server ? > > > > > > > > > > > > > > > > > ___________________________________________________________________________ > > 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 > > > > > > > ------------------------------------------------------- > > 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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > _______________________________________________ > > 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: elec <ele...@gm...> - 2006-01-02 16:56:25
|
read the previous threads....you need a to add a package Math::BigInt::GMP perl -MCPAN -e "install Math::BigInt::GMP" On 1/2/06, Miky J <mi...@ya...> wrote: > > Hello and happy new year, > > I'm trying to automatise a logging script to check the > config on many linux machines. > > - Some machines use SSH 1 and 2, by default it's the > version 1 and > I have a warning coming from the perl module. > Argument "ssh-rsa" isn't numeric in numeric eq (=3D=3D) at > /usr/lib/perl5/site_perl/5.8.6/Net/SSH/Perl/Key/RSA1.pm > line 94, <FH> line 20. > > - By default I'd like to use SSH 2 all the time but > it's very slow to log in, more than one minute. But > when i do > $ssh -2 root@the_host > it's fast. > > My Debug > -------- > > $ ./newssh.pl > Trying to log in > admin: Reading configuration data > /home/mikydeb/.ssh/config > admin: Reading configuration data /etc/ssh_config > admin: Connecting to the_host, port 22. > admin: Remote protocol version 1.99, remote software > version OpenSSH_3.6.1p2 > admin: Net::SSH::Perl Version 1.29, protocol version > 2.0. > admin: No compat match: OpenSSH_3.6.1p2. > admin: Connection established. > envoi password et loggin : root, the_password > admin: Sent key-exchange init (KEXINIT), wait > response. > admin: Algorithms, c->s: 3des-cbc hmac-sha1 none > admin: Algorithms, s->c: 3des-cbc hmac-sha1 none > > <---25 seconds---> > > admin: Entering Diffie-Hellman Group 1 key exchange. > admin: Sent DH public key, waiting for reply. > admin: Received host key, type 'ssh-dss'. > admin: Host 'the_host' is known and matches the host > key. > admin: Computing shared secret key. > > <---25 seconds---> > > admin: Verifying server signature. > > <---10 seconds---> > > admin: Waiting for NEWKEYS message. > admin: Enabling incoming encryption/MAC/compression. > admin: Send NEWKEYS, enable outgoing > encryption/MAC/compression. > admin: Sending request for user-authentication > service. > admin: Service accepted: ssh-userauth. > admin: Trying empty user-authentication request. > admin: Authentication methods that can continue: > publickey,password,keyboard-interactive. > admin: Next method to try is publickey. > admin: Trying pubkey authentication with key file > '/home/mikydeb/.ssh/id_dsa' > admin: Authentication methods that can continue: > publickey,password,keyboard-interactive. > admin: Next method to try is publickey. > admin: Next method to try is password. > admin: Trying password authentication. > admin: Login completed, opening dummy shell channel. > admin: channel 0: new [client-session] > admin: Requesting channel_open for channel 0. > admin: channel 0: open confirm rwindow 0 rmax 32768 > admin: Got channel open confirmation, requesting > shell. > admin: Requesting service shell on channel 0. > Loggin OK > admin: channel 1: new [client-session] > admin: Requesting channel_open for channel 1. > admin: Entering interactive session. > admin: Sending command: ps -ef > admin: Requesting service exec on channel 1. > admin: channel 1: open confirm rwindow 0 rmax 32768 > admin: input_channel_request: rtype exit-status reply > 0 > admin: channel 1: rcvd eof > admin: channel 1: output open -> drain > admin: channel 1: rcvd close > admin: channel 1: input open -> closed > admin: channel 1: close_read > admin: channel 1: obuf empty > admin: channel 1: output drain -> closed > admin: channel 1: close_write > admin: channel 1: send close > admin: channel 1: full closed > > > My script > --------- > > #!/usr/bin/perl -w > > my $host=3D"the_host"; > my $login=3D'root'; > my $password=3D'the_password'; > my $commande=3D'ps -ef'; > > login($login,$password,$host, $commande); > > sub login > { > my ($login, $password, $host, $cmd) =3D @_; > my $dump =3D 'dump.txt'; > open (DUMP, ">>$dump") or die "Impossible d'ouvrir > le fichier $dump"; > > print "Trying to log in\n"; > # Force version 2 > my $ssh =3D Net::SSH::Perl->new($host, protocol=3D>'2', > port=3D>22, debug=3D>"true"); > > print "Sending password and loggin : $login, > $password\n"; > $ssh->login($login, $password); > print "Loggin OK\n"; > > my($resultat, $stderr, $exit) =3D $ssh->cmd($cmd); > print DUMP "$host\t$resultat"; > close DUMP; > } > > > Do you have any idea of what causes this, is it a > problem in my script ? or maybe on the server ? > > > > > > > > _________________________________________________________________________= __ > Nouveau : t=E9l=E9phonez moins cher avec Yahoo! Messenger ! D=E9couvez le= s > tarifs exceptionnels pour appeler la France et l'international. > T=E9l=E9chargez sur http://fr.messenger.yahoo.com > > > ------------------------------------------------------- > 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://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: Miky J <mi...@ya...> - 2006-01-02 10:25:37
|
Hello and happy new year, I'm trying to automatise a logging script to check the config on many linux machines. - Some machines use SSH 1 and 2, by default it's the version 1 and I have a warning coming from the perl module. Argument "ssh-rsa" isn't numeric in numeric eq (==) at /usr/lib/perl5/site_perl/5.8.6/Net/SSH/Perl/Key/RSA1.pm line 94, <FH> line 20. - By default I'd like to use SSH 2 all the time but it's very slow to log in, more than one minute. But when i do $ssh -2 root@the_host it's fast. My Debug -------- $ ./newssh.pl Trying to log in admin: Reading configuration data /home/mikydeb/.ssh/config admin: Reading configuration data /etc/ssh_config admin: Connecting to the_host, port 22. admin: Remote protocol version 1.99, remote software version OpenSSH_3.6.1p2 admin: Net::SSH::Perl Version 1.29, protocol version 2.0. admin: No compat match: OpenSSH_3.6.1p2. admin: Connection established. envoi password et loggin : root, the_password admin: Sent key-exchange init (KEXINIT), wait response. admin: Algorithms, c->s: 3des-cbc hmac-sha1 none admin: Algorithms, s->c: 3des-cbc hmac-sha1 none <---25 seconds---> admin: Entering Diffie-Hellman Group 1 key exchange. admin: Sent DH public key, waiting for reply. admin: Received host key, type 'ssh-dss'. admin: Host 'the_host' is known and matches the host key. admin: Computing shared secret key. <---25 seconds---> admin: Verifying server signature. <---10 seconds---> admin: Waiting for NEWKEYS message. admin: Enabling incoming encryption/MAC/compression. admin: Send NEWKEYS, enable outgoing encryption/MAC/compression. admin: Sending request for user-authentication service. admin: Service accepted: ssh-userauth. admin: Trying empty user-authentication request. admin: Authentication methods that can continue: publickey,password,keyboard-interactive. admin: Next method to try is publickey. admin: Trying pubkey authentication with key file '/home/mikydeb/.ssh/id_dsa' admin: Authentication methods that can continue: publickey,password,keyboard-interactive. admin: Next method to try is publickey. admin: Next method to try is password. admin: Trying password authentication. admin: Login completed, opening dummy shell channel. admin: channel 0: new [client-session] admin: Requesting channel_open for channel 0. admin: channel 0: open confirm rwindow 0 rmax 32768 admin: Got channel open confirmation, requesting shell. admin: Requesting service shell on channel 0. Loggin OK admin: channel 1: new [client-session] admin: Requesting channel_open for channel 1. admin: Entering interactive session. admin: Sending command: ps -ef admin: Requesting service exec on channel 1. admin: channel 1: open confirm rwindow 0 rmax 32768 admin: input_channel_request: rtype exit-status reply 0 admin: channel 1: rcvd eof admin: channel 1: output open -> drain admin: channel 1: rcvd close admin: channel 1: input open -> closed admin: channel 1: close_read admin: channel 1: obuf empty admin: channel 1: output drain -> closed admin: channel 1: close_write admin: channel 1: send close admin: channel 1: full closed My script --------- #!/usr/bin/perl -w my $host="the_host"; my $login='root'; my $password='the_password'; my $commande='ps -ef'; login($login,$password,$host, $commande); sub login { my ($login, $password, $host, $cmd) = @_; my $dump = 'dump.txt'; open (DUMP, ">>$dump") or die "Impossible d'ouvrir le fichier $dump"; print "Trying to log in\n"; # Force version 2 my $ssh = Net::SSH::Perl->new($host, protocol=>'2', port=>22, debug=>"true"); print "Sending password and loggin : $login, $password\n"; $ssh->login($login, $password); print "Loggin OK\n"; my($resultat, $stderr, $exit) = $ssh->cmd($cmd); print DUMP "$host\t$resultat"; close DUMP; } Do you have any idea of what causes this, is it a problem in my script ? or maybe on the server ? ___________________________________________________________________________ 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 |