ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 17)
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: Chakresh Y. <cy...@ns...> - 2007-01-12 18:37:06
|
Thanks for prompt reply. I tried this piece of code but don't see pl script exiting on the windows box. The command is successfully executed on the remote Unix server. I go to the unix box and stop the service and then perl script exits successfully. Does this give any clue what's going on ??? I tried giving the command "touch /tmp/abc.txt" and the file is created on unix server and perl scipt also exits. Why perl script behaves differently for these 2 different commands on remote box ? Thanks Chakresh _____ From: Sant'Anna, Paulo (IT) [mailto:Pau...@mo...] Sent: Friday, January 12, 2007 7:21 AM To: cy...@ns...; ssh...@li... Subject: RE: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl I don't think the connection is dropped after a command is send. You might want to add: $ssh->cmd("exit"); to your script to close the connection. Thanks, -- Paulo _____ From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Chakresh Yadav Sent: Thursday, January 11, 2007 9:55 PM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl Hi, I am running a simple script to execute a command on a remote linux server. The machine on which pl script is running is windows XP (no cygwin installed). Below is the script and output #testing script use Net::SSH::Perl; $targetIP = shift; $userName = shift; $password = shift; $sourceFileName = shift; $destinationDir = shift; my $ssh = Net::SSH::Perl->new($targetIP, debug=>1); $ssh->login($userName,$password); $ssh->cmd("service snmpd start"); print "Bye"; The debug output is ChakreshYadavPC: Reading configuration data /.ssh/config ChakreshYadavPC: Reading configuration data /etc/ssh_config ChakreshYadavPC: Connecting to 192.168.1.203, port 22. ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 ChakreshYadavPC: Remote protocol version 1.99, remote software version OpenSSH_3 .5p1 ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. ChakreshYadavPC: No compat match: OpenSSH_3.5p1. ChakreshYadavPC: Connection established. ChakreshYadavPC: Waiting for server public key. ChakreshYadavPC: Received server public key (768 bits) and host key (1024 bits). ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. ChakreshYadavPC: Encryption type: DES3 ChakreshYadavPC: Sent encrypted session key. ChakreshYadavPC: Received encryption confirmation. ChakreshYadavPC: RSA authentication failed: Can't load public key. ChakreshYadavPC: Doing challenge response authentication. ChakreshYadavPC: No challenge presented. ChakreshYadavPC: Trying password authentication. ChakreshYadavPC: Sending command: service snmpd start ChakreshYadavPC: Entering interactive session. The scipt does not exit after sending command to remote box. I can see service "snmpd" running on remote Unix server but no message "Bye" on windows box. Does anyone has faced this issue ? Any pointers will be highly appreciated as I need this script to run ASAP. Thanks Chakresh _____ NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. |
From: Chakresh Y. <cy...@ns...> - 2007-01-12 18:34:49
|
Thanks for prompt reply. I tried this piece of code but cannot see the exit code on the windows box. The command is successfully executed on the remote Unix server. I go to the unix box and stop the service and then perl script exits successfully. Does this give any clue what's going on ??? Thanks Chakresh -----Original Message----- From: rkb@i.frys.com [mailto:rkb@i.frys.com] Sent: Friday, January 12, 2007 9:35 AM To: cy...@ns... Cc: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl Try checking the exit code of the command. my ($stdout, $stderr, $exit) = $ssh->cmd("service snmpd start"); if ($exit != 0 { warn "An error has occured - exit code:$exit\nerror message:$stderr"; } else { print "ssh command succeeded - Good Bye"; } > Hi, > > > > I am running a simple script to execute a command on a remote linux > server. > The machine on which pl script is running is windows XP (no cygwin > installed). Below is the script and output > > > > #testing script > > use Net::SSH::Perl; > > > > $targetIP = shift; > > $userName = shift; > > $password = shift; > > $sourceFileName = shift; > > $destinationDir = shift; > > > > my $ssh = Net::SSH::Perl->new($targetIP, debug=>1); > > $ssh->login($userName,$password); > > > > $ssh->cmd("service snmpd start"); > > > > print "Bye"; > > > > The debug output is > > > > ChakreshYadavPC: Reading configuration data /.ssh/config > > ChakreshYadavPC: Reading configuration data /etc/ssh_config > > ChakreshYadavPC: Connecting to 192.168.1.203, port 22. > > ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 > > > > ChakreshYadavPC: Remote protocol version 1.99, remote software version > OpenSSH_3 > > .5p1 > > ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. > > ChakreshYadavPC: No compat match: OpenSSH_3.5p1. > > ChakreshYadavPC: Connection established. > > ChakreshYadavPC: Waiting for server public key. > > ChakreshYadavPC: Received server public key (768 bits) and host key (1024 > bits). > > > > ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. > > ChakreshYadavPC: Encryption type: DES3 > > ChakreshYadavPC: Sent encrypted session key. > > ChakreshYadavPC: Received encryption confirmation. > > ChakreshYadavPC: RSA authentication failed: Can't load public key. > > ChakreshYadavPC: Doing challenge response authentication. > > ChakreshYadavPC: No challenge presented. > > ChakreshYadavPC: Trying password authentication. > > ChakreshYadavPC: Sending command: service snmpd start > > ChakreshYadavPC: Entering interactive session. > > > > > > The scipt does not exit after sending command to remote box. I can see > service "snmpd" running on remote Unix server but no message "Bye" on > windows box. > > > > Does anyone has faced this issue ? Any pointers will be highly appreciated > as I need this script to run ASAP. > > > > Thanks > > Chakresh > > > > > > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ ____________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: rkb@i.frys.com - 2007-01-12 17:35:14
|
Try checking the exit code of the command. my ($stdout, $stderr, $exit) = $ssh->cmd("service snmpd start"); if ($exit != 0 { warn "An error has occured - exit code:$exit\nerror message:$stderr"; } else { print "ssh command succeeded - Good Bye"; } > Hi, > > > > I am running a simple script to execute a command on a remote linux > server. > The machine on which pl script is running is windows XP (no cygwin > installed). Below is the script and output > > > > #testing script > > use Net::SSH::Perl; > > > > $targetIP = shift; > > $userName = shift; > > $password = shift; > > $sourceFileName = shift; > > $destinationDir = shift; > > > > my $ssh = Net::SSH::Perl->new($targetIP, debug=>1); > > $ssh->login($userName,$password); > > > > $ssh->cmd("service snmpd start"); > > > > print "Bye"; > > > > The debug output is > > > > ChakreshYadavPC: Reading configuration data /.ssh/config > > ChakreshYadavPC: Reading configuration data /etc/ssh_config > > ChakreshYadavPC: Connecting to 192.168.1.203, port 22. > > ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 > > > > ChakreshYadavPC: Remote protocol version 1.99, remote software version > OpenSSH_3 > > .5p1 > > ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. > > ChakreshYadavPC: No compat match: OpenSSH_3.5p1. > > ChakreshYadavPC: Connection established. > > ChakreshYadavPC: Waiting for server public key. > > ChakreshYadavPC: Received server public key (768 bits) and host key (1024 > bits). > > > > ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. > > ChakreshYadavPC: Encryption type: DES3 > > ChakreshYadavPC: Sent encrypted session key. > > ChakreshYadavPC: Received encryption confirmation. > > ChakreshYadavPC: RSA authentication failed: Can't load public key. > > ChakreshYadavPC: Doing challenge response authentication. > > ChakreshYadavPC: No challenge presented. > > ChakreshYadavPC: Trying password authentication. > > ChakreshYadavPC: Sending command: service snmpd start > > ChakreshYadavPC: Entering interactive session. > > > > > > The scipt does not exit after sending command to remote box. I can see > service "snmpd" running on remote Unix server but no message "Bye" on > windows box. > > > > Does anyone has faced this issue ? Any pointers will be highly appreciated > as I need this script to run ASAP. > > > > Thanks > > Chakresh > > > > > > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: Sant'Anna, P. \(IT\) <Pau...@mo...> - 2007-01-12 15:21:21
|
I don't think the connection is dropped after a command is send. You might want to add: =20 $ssh->cmd("exit"); =20 to your script to close the connection. =20 Thanks, =20 -- Paulo =20 ________________________________ From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Chakresh Yadav Sent: Thursday, January 11, 2007 9:55 PM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Problem using Net::SSH::Perl Hi, =20 I am running a simple script to execute a command on a remote linux server. The machine on which pl script is running is windows XP (no cygwin installed). Below is the script and output =20 #testing script use Net::SSH::Perl; =20 $targetIP =3D shift; $userName =3D shift; $password =3D shift; $sourceFileName =3D shift; $destinationDir =3D shift; =20 my $ssh =3D Net::SSH::Perl->new($targetIP, debug=3D>1); $ssh->login($userName,$password); =20 $ssh->cmd("service snmpd start"); =20 print "Bye"; =20 The debug output is=20 =20 ChakreshYadavPC: Reading configuration data /.ssh/config ChakreshYadavPC: Reading configuration data /etc/ssh_config ChakreshYadavPC: Connecting to 192.168.1.203, port 22. ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 =20 ChakreshYadavPC: Remote protocol version 1.99, remote software version OpenSSH_3 .5p1 ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. ChakreshYadavPC: No compat match: OpenSSH_3.5p1. ChakreshYadavPC: Connection established. ChakreshYadavPC: Waiting for server public key. ChakreshYadavPC: Received server public key (768 bits) and host key (1024 bits). =20 ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. ChakreshYadavPC: Encryption type: DES3 ChakreshYadavPC: Sent encrypted session key. ChakreshYadavPC: Received encryption confirmation. ChakreshYadavPC: RSA authentication failed: Can't load public key. ChakreshYadavPC: Doing challenge response authentication. ChakreshYadavPC: No challenge presented. ChakreshYadavPC: Trying password authentication. ChakreshYadavPC: Sending command: service snmpd start ChakreshYadavPC: Entering interactive session. =20 =20 The scipt does not exit after sending command to remote box. I can see service "snmpd" running on remote Unix server but no message "Bye" on windows box. =20 Does anyone has faced this issue ? Any pointers will be highly appreciated as I need this script to run ASAP. =20 Thanks Chakresh -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender = does not intend to waive confidentiality or privilege. Use of this email = is prohibited when received in error. |
From: Chakresh Y. <cy...@ns...> - 2007-01-12 02:56:41
|
Hi, I am running a simple script to execute a command on a remote linux server. The machine on which pl script is running is windows XP (no cygwin installed). Below is the script and output #testing script use Net::SSH::Perl; $targetIP = shift; $userName = shift; $password = shift; $sourceFileName = shift; $destinationDir = shift; my $ssh = Net::SSH::Perl->new($targetIP, debug=>1); $ssh->login($userName,$password); $ssh->cmd("service snmpd start"); print "Bye"; The debug output is ChakreshYadavPC: Reading configuration data /.ssh/config ChakreshYadavPC: Reading configuration data /etc/ssh_config ChakreshYadavPC: Connecting to 192.168.1.203, port 22. ChakreshYadavPC: Remote version string: SSH-1.99-OpenSSH_3.5p1 ChakreshYadavPC: Remote protocol version 1.99, remote software version OpenSSH_3 .5p1 ChakreshYadavPC: Net::SSH::Perl Version 1.30, protocol version 1.5. ChakreshYadavPC: No compat match: OpenSSH_3.5p1. ChakreshYadavPC: Connection established. ChakreshYadavPC: Waiting for server public key. ChakreshYadavPC: Received server public key (768 bits) and host key (1024 bits). ChakreshYadavPC: Host '192.168.1.203' is known and matches the host key. ChakreshYadavPC: Encryption type: DES3 ChakreshYadavPC: Sent encrypted session key. ChakreshYadavPC: Received encryption confirmation. ChakreshYadavPC: RSA authentication failed: Can't load public key. ChakreshYadavPC: Doing challenge response authentication. ChakreshYadavPC: No challenge presented. ChakreshYadavPC: Trying password authentication. ChakreshYadavPC: Sending command: service snmpd start ChakreshYadavPC: Entering interactive session. The scipt does not exit after sending command to remote box. I can see service "snmpd" running on remote Unix server but no message "Bye" on windows box. Does anyone has faced this issue ? Any pointers will be highly appreciated as I need this script to run ASAP. Thanks Chakresh |
From: Uday K. M. <umo...@me...> - 2007-01-05 16:43:43
|
#!/usr/bin/perl use Net::SSH::Perl; use threads; use threads::shared; my $date : shared; my $i : shared = 1; my @stdout : shared; my @stderr : shared; my @exit : shared; print "Starting Thread date...\n"; $thr1 = threads->new( sub { while($i==1) { $date = `date +%Y%m%d`; $date += ""; $date .= "0000"; } } ); print "Starting SSH...\n"; sleep(2); $thr2 = threads->new(sub { my $ssh = Net::SSH::Perl->new("host"); $ssh->login("user", "password"); my ($stdout,$stderr,$exit) = $ssh -> cmd("tail -f /tmp/file_$date"); #print STDOUT (`ssh user\@host \'tail /home/omni/tickets/\'`."grnti_$date"); }); while (<STDOUT>) { ($Fld1,$Fld2,$Fld3,$Fld4,$Fld5,$Fld6,$Fld7,$Fld8,$Fld9,$Fld10,$Fld11, $Fld12,$Fld13,$Fld14,$Fld15,$Fld16,$Fld17,$Fld18,$Fld19,$Fld20,$Fld21, $Fld22,$Fld23,$Fld24,$Fld25,$Fld26,$Fld27,$Fld28,$Fld29,$Fld30,$Fld31,$Fld32,$Fld33) = split(' ', $_, 9999); while (($_ = &Getline0(),$getline_ok)) { print _BIN_BASH "echo \"insert into cause_history (ddate,location,cause,input,output) values(\\\"" . $Fld5 . $Fld6 . "\\\",\\\"" . substr($Fld29, 1, 1) . "\\\",\\\"" . substr($Fld29, 2, 3) . "\\\",\\\"" . $Fld32 . "\\\",\\\"" . $Fld33 . "\\\")\""; } } sub Getline0 { if ($getline_ok = (($_ = <>) ne '')) { ($Fld1,$Fld2,$Fld3,$Fld4,$Fld5,$Fld6,$Fld7,$Fld8,$Fld9,$Fld10,$Fld11, $Fld12,$Fld13,$Fld14,$Fld15,$Fld16,$Fld17,$Fld18,$Fld19,$Fld20,$Fld21, $Fld22,$Fld23,$Fld24,$Fld25,$Fld26,$Fld27,$Fld28,$Fld29,$Fld30,$Fld31,$Fld32,$Fld33) = split(' ', $_, 9999); } $_; } $i = 0; sleep(3); exit; |
From: Glen F. <gfo...@ho...> - 2006-12-28 12:41:28
|
Hi, Thanks for the help, I just did a my $ip = pack('C*', unpack('C*', $_)); in each of the variables I was reading from the xml and everything worked!!! Thanks again -PBK-, Glen >From: Phillip.Keegstra >To: Glen Farmer >Subject: Re: [Ssh-sftp-perl-users] input must be 8 bytes long at >Crypt/DES.pmline 57 >Date: Wed, 27 Dec 2006 12:24:36 -0500 > > >You need to become friends with the Cargo Cult.... > >You need to turn the UTF-8ness off of the strings you get from XML.... > > > # For some truly bizarre cargocult reason > # SFTP only works if we strip utf8ness. > my $ip = pack('C*', unpack('C*', $_)); > my $ff = pack('C*', unpack('C*', ${$ftpref}{$_})); > my($ll,$user,$pass,$path_there) = split(/\t/, $ff); > > > -PBK- > > > >----- Original Message ----- >From: Glen Farmer >Date: Wednesday, December 27, 2006 11:41 am >Subject: [Ssh-sftp-perl-users] input must be 8 bytes long at >Crypt/DES.pm line 57 > > > Hi I'm a newbie to perl and I was trying to write a script to read > > a xml > > with all the info for the connection and all the commands that need > > to run > > on the remote machine. I was using Net::SSH::Perl and it works if I > > don't > > get the variables from the xml, but if I read the xml using > > XML::Simple or > > XML:Smart it give the the following error: > > > > input must be 8 bytes long at > > /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/Crypt/DES.pm > > line 57. > > > > If I put in the info to login to the ssh server hardcoded in the > > script it > > works but when ever I use the variables that were read by the XML > > modules it > > give me the error. > > > > If I hardcode the login info to the script and then try to use > > commands that > > were read from the xml script it give me the same error. > > > > Can someone help me please!!! > > > > Thanks in advance, > > Glen > > > > I'm running: > > opensuse 10.1. Net > > This is perl, v5.8.8 built for i586-linux-thread-multi > > Net-SSH-Perl-1.30 > > Crypt-DES-2.05 > > XML-Simple-2.16 > > XML-Smart-1.6.9 > > cpan script version 1.03 > > CPAN.pm version 1.7602 > > > > > > The script is: > > > > #!/usr/bin/perl -w > > > > use XML::Smart; > > use Net::SSH::Perl; > > > > my $XML = XML::Smart->new($ARGV[0]); > > > > my $host = $XML->{Server}->{ip}; > > my $user = $XML->{Server}->{user}; > > my $password = $XML->{Server}->{password}; > > > > my $ssh = Net::SSH::Perl->new ($host); > > $ssh->login($user, $password); > > print "Connected...\n"; > > > > > > The XML -------------------------------- > > <Server> > > <ip>10.10.10.10</ip> > > <user>userName</user> > > <password>password</password> > > <Commands> > > <Command>cd d:/</Command> > > </Commands> > > </Server> > > _________________________________________________________________ The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/ |
From: Heinrich, M. <Mat...@sa...> - 2006-12-27 23:24:25
|
Wow... It looks like either the XML::Smart or Object::MultiType (required by the XML::Smart module) has stepped on Math:BigInt (don't ask me how...) =20 I ran into the same problem when I installed the XML module. My SSH script, which has always worked, stopped working, and looped an error message complaining of an uninitialized variable being used, which may be similar to what you were experiencing. I tried removing and reinstalling a couple of modules (Crypt::DH, Math::BigInt::GMP, and some more) , but nothing got it to work until I removed Math::BigInt! I got a list of modules to remove: $ make uninstall unlink /usr/lib/perl5/5.8.0/Math/BigFloat.pm unlink /usr/lib/perl5/5.8.0/Math/BigInt.pm unlink /usr/lib/perl5/5.8.0/Math/BigInt/Calc.pm unlink /usr/lib/perl5/5.8.0/Math/BigInt/CalcEmu.pm unlink /usr/share/man/man3/Math::BigFloat.3pm unlink /usr/share/man/man3/Math::BigInt.3pm unlink /usr/share/man/man3/Math::BigInt::Calc.3pm unlink /usr/share/man/man3/Math::BigInt::CalcEmu.3pm unlink /usr/lib/perl5/5.8.0/i386-linux-thread-multi/auto/Math-BigInt/.packlist Uninstall is deprecated. Please check the packlist above carefully. There may be errors. Remove the appropriate files manually. Sorry for the inconveniences. Then just copied all the unlink commands and pasted to the bash shell. Then I just did another "perl Makefil.PL", "make", then "make install" and now it seems to work! -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Glen Farmer Sent: Wednesday, December 27, 2006 10:42 AM To: ssh...@li... Subject: [Ssh-sftp-perl-users] input must be 8 bytes long at Crypt/DES.pmline 57 Hi I'm a newbie to perl and I was trying to write a script to read a xml with all the info for the connection and all the commands that need to run on the remote machine. I was using Net::SSH::Perl and it works if I don't get the variables from the xml, but if I read the xml using XML::Simple or XML:Smart it give the the following error: input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/Crypt/DES.pm line 57. If I put in the info to login to the ssh server hardcoded in the script it works but when ever I use the variables that were read by the XML modules it give me the error. If I hardcode the login info to the script and then try to use commands that were read from the xml script it give me the same error. Can someone help me please!!! Thanks in advance, Glen I'm running: opensuse 10.1. Net This is perl, v5.8.8 built for i586-linux-thread-multi Net-SSH-Perl-1.30 Crypt-DES-2.05 XML-Simple-2.16 XML-Smart-1.6.9 cpan script version 1.03 CPAN.pm version 1.7602 The script is: #!/usr/bin/perl -w use XML::Smart; use Net::SSH::Perl; my $XML =3D XML::Smart->new($ARGV[0]); my $host =3D $XML->{Server}->{ip}; my $user =3D $XML->{Server}->{user}; my $password =3D $XML->{Server}->{password}; my $ssh =3D Net::SSH::Perl->new ($host); $ssh->login($user, $password); print "Connected...\n"; The XML -------------------------------- <Server> <ip>10.10.10.10</ip> <user>userName</user> <password>password</password> <Commands> <Command>cd d:/</Command> </Commands> </Server> _________________________________________________________________ >From photos to predictions, The MSN Entertainment Guide to Golden=20 >Globes has it all. http://tv.msn.com/tv/globes2007/ ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Glen F. <gfo...@ho...> - 2006-12-27 16:41:58
|
Hi I'm a newbie to perl and I was trying to write a script to read a xml with all the info for the connection and all the commands that need to run on the remote machine. I was using Net::SSH::Perl and it works if I don't get the variables from the xml, but if I read the xml using XML::Simple or XML:Smart it give the the following error: input must be 8 bytes long at /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/Crypt/DES.pm line 57. If I put in the info to login to the ssh server hardcoded in the script it works but when ever I use the variables that were read by the XML modules it give me the error. If I hardcode the login info to the script and then try to use commands that were read from the xml script it give me the same error. Can someone help me please!!! Thanks in advance, Glen I'm running: opensuse 10.1. Net This is perl, v5.8.8 built for i586-linux-thread-multi Net-SSH-Perl-1.30 Crypt-DES-2.05 XML-Simple-2.16 XML-Smart-1.6.9 cpan script version 1.03 CPAN.pm version 1.7602 The script is: #!/usr/bin/perl -w use XML::Smart; use Net::SSH::Perl; my $XML = XML::Smart->new($ARGV[0]); my $host = $XML->{Server}->{ip}; my $user = $XML->{Server}->{user}; my $password = $XML->{Server}->{password}; my $ssh = Net::SSH::Perl->new ($host); $ssh->login($user, $password); print "Connected...\n"; The XML -------------------------------- <Server> <ip>10.10.10.10</ip> <user>userName</user> <password>password</password> <Commands> <Command>cd d:/</Command> </Commands> </Server> _________________________________________________________________ >From photos to predictions, The MSN Entertainment Guide to Golden Globes has it all. http://tv.msn.com/tv/globes2007/ |
From: Sander P. <San...@da...> - 2006-12-19 21:30:28
|
Sure thing. It's the compiled version of the heavy lifting integer math module that saves a lot of time. It's been more than a year since I ran into the same problem, sorry for not recalling the exact module right away. Sander=20 > -----Original Message----- > From: rkb@i.frys.com [mailto:rkb@i.frys.com]=20 > Sent: Tuesday, December 19, 2006 4:27 PM > To: Sander Pool=20 > Cc: Thompson, Mark; ssh...@li... > Subject: RE: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > authentication is taking1 minute 40 seconds >=20 > After doing a quick check, I found that Math::BigInt was=20 > already installed, so I installed Math::BigInt::CMP which=20 > reduced the login time to 1 - 5 seconds depending on the server load. >=20 > Thanks for the help. >=20 > Ron >=20 > > > > Install Math::BigInt::GMP, that's the one that typically=20 > causes slow=20 > > performance if it's not installed. > > > > Sander > > > >> -----Original Message----- > >> From: rkb@i.frys.com [mailto:rkb@i.frys.com] > >> Sent: Monday, December 18, 2006 2:36 PM > >> To: Sander Pool > >> Cc: Thompson, Mark; ssh...@li... > >> Subject: RE: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > >> authentication is taking1 minute 40 seconds > >> > >> Thanks for the suggestions. > >> > >> Another person said that the missing module dependency is=20 > >> Math::BigInt, which is what I think you meant, and I'll=20 > give it a try=20 > >> tomorrow when I get into to office. > >> > >> I tried searching the archive, but didn't have much luck,=20 > because the=20 > >> whitespace and \n line endings were removed from the=20 > postings, which=20 > >> makes it very difficult to read/follow. > >> I assume that the posts display their proper format once you're=20 > >> logged in, but it's not accepting my username and/or password. =20 > >> However, I can login from the "registration page" > >> and change my personal settings, I just can't login to the archive. > >> > >> Ron > >> > >> > > >> > Just about everyone has this issue when they first use the > >> module. The > >> > dependencies are incomplete. You'll need to install=20 > GMP::BigInt or=20 > >> > whatever the module is called. Check the archives. Search > >> for GMP or > >> > performance. > >> > > >> > Sander > >> > > >> >> -----Original Message----- > >> >> From: ssh...@li... > >> >> [mailto:ssh...@li...] > >> On Behalf > >> >> Of Thompson, Mark > >> >> Sent: Monday, December 18, 2006 4:43 AM > >> >> To: rkb@i.frys.com; ssh...@li... > >> >> Subject: Re: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > >> >> authentication is taking1 minute 40 seconds > >> >> > >> >> I had a similar issue when I first installed Net::SSH::Perl. > >> >> I think it's down to using perl versions of some of the=20 > encryption=20 > >> >> libraries. > >> >> I'm afraid I can't remember exactly what I did, but I=20 > went through=20 > >> >> the encryption modules and made sure I have nativley compliled=20 > >> >> versions. > >> >> This dramtically reduced my login times as=20 > Net::SSH::Perl was'nt=20 > >> >> having to use perl code to encrypt and decrypt. > >> >> > >> >> Hope this helps, > >> >> > >> >> Mark > >> >> > >> >> -----Original Message----- > >> >> From: ssh...@li... > >> >> [mailto:ssh...@li...] > >> On Behalf > >> >> Of rkb@i.frys.com > >> >> Sent: 17 December 2006 06:37 > >> >> To: ssh...@li... > >> >> Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login > >> authentication is > >> >> taking1 minute 40 seconds > >> >> > >> >> I'm developing a cgi script that uses Net::SSH::Perl, but > >> the login > >> >> authentication is taking 1 minute 40 seconds. As you=20 > can imagine,=20 > >> >> 1:40 too long especially since I will be connecting to=20 > 4 servers. > >> >> > >> >> Is this a known issue and is there a workaround? > >> >> > >> > >> > > > > >=20 >=20 >=20 |
From: rkb@i.frys.com - 2006-12-19 21:27:58
|
After doing a quick check, I found that Math::BigInt was already installed, so I installed Math::BigInt::CMP which reduced the login time to 1 - 5 seconds depending on the server load. Thanks for the help. Ron > > Install Math::BigInt::GMP, that's the one that typically causes slow > performance if it's not installed. > > Sander > >> -----Original Message----- >> From: rkb@i.frys.com [mailto:rkb@i.frys.com] >> Sent: Monday, December 18, 2006 2:36 PM >> To: Sander Pool >> Cc: Thompson, Mark; ssh...@li... >> Subject: RE: [Ssh-sftp-perl-users] Net::SSH::Perl login >> authentication is taking1 minute 40 seconds >> >> Thanks for the suggestions. >> >> Another person said that the missing module dependency is >> Math::BigInt, which is what I think you meant, and I'll give >> it a try tomorrow when I get into to office. >> >> I tried searching the archive, but didn't have much luck, >> because the whitespace and \n line endings were removed from >> the postings, which makes it very difficult to read/follow. >> I assume that the posts display their proper format once >> you're logged in, but it's not accepting my username and/or >> password. However, I can login from the "registration page" >> and change my personal settings, I just can't login to the archive. >> >> Ron >> >> > >> > Just about everyone has this issue when they first use the >> module. The >> > dependencies are incomplete. You'll need to install GMP::BigInt or >> > whatever the module is called. Check the archives. Search >> for GMP or >> > performance. >> > >> > Sander >> > >> >> -----Original Message----- >> >> From: ssh...@li... >> >> [mailto:ssh...@li...] >> On Behalf >> >> Of Thompson, Mark >> >> Sent: Monday, December 18, 2006 4:43 AM >> >> To: rkb@i.frys.com; ssh...@li... >> >> Subject: Re: [Ssh-sftp-perl-users] Net::SSH::Perl login >> >> authentication is taking1 minute 40 seconds >> >> >> >> I had a similar issue when I first installed Net::SSH::Perl. >> >> I think it's down to using perl versions of some of the encryption >> >> libraries. >> >> I'm afraid I can't remember exactly what I did, but I went through >> >> the encryption modules and made sure I have nativley compliled >> >> versions. >> >> This dramtically reduced my login times as Net::SSH::Perl was'nt >> >> having to use perl code to encrypt and decrypt. >> >> >> >> Hope this helps, >> >> >> >> Mark >> >> >> >> -----Original Message----- >> >> From: ssh...@li... >> >> [mailto:ssh...@li...] >> On Behalf >> >> Of rkb@i.frys.com >> >> Sent: 17 December 2006 06:37 >> >> To: ssh...@li... >> >> Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login >> authentication is >> >> taking1 minute 40 seconds >> >> >> >> I'm developing a cgi script that uses Net::SSH::Perl, but >> the login >> >> authentication is taking 1 minute 40 seconds. As you can imagine, >> >> 1:40 too long especially since I will be connecting to 4 servers. >> >> >> >> Is this a known issue and is there a workaround? >> >> >> >> > > |
From: Sander P. <San...@da...> - 2006-12-18 19:55:47
|
Install Math::BigInt::GMP, that's the one that typically causes slow performance if it's not installed. Sander=20 > -----Original Message----- > From: rkb@i.frys.com [mailto:rkb@i.frys.com]=20 > Sent: Monday, December 18, 2006 2:36 PM > To: Sander Pool=20 > Cc: Thompson, Mark; ssh...@li... > Subject: RE: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > authentication is taking1 minute 40 seconds >=20 > Thanks for the suggestions. >=20 > Another person said that the missing module dependency is=20 > Math::BigInt, which is what I think you meant, and I'll give=20 > it a try tomorrow when I get into to office. >=20 > I tried searching the archive, but didn't have much luck,=20 > because the whitespace and \n line endings were removed from=20 > the postings, which makes it very difficult to read/follow. =20 > I assume that the posts display their proper format once=20 > you're logged in, but it's not accepting my username and/or=20 > password. However, I can login from the "registration page"=20 > and change my personal settings, I just can't login to the archive. >=20 > Ron >=20 > > > > Just about everyone has this issue when they first use the=20 > module. The=20 > > dependencies are incomplete. You'll need to install GMP::BigInt or=20 > > whatever the module is called. Check the archives. Search=20 > for GMP or=20 > > performance. > > > > Sander > > > >> -----Original Message----- > >> From: ssh...@li... > >> [mailto:ssh...@li...]=20 > On Behalf=20 > >> Of Thompson, Mark > >> Sent: Monday, December 18, 2006 4:43 AM > >> To: rkb@i.frys.com; ssh...@li... > >> Subject: Re: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > >> authentication is taking1 minute 40 seconds > >> > >> I had a similar issue when I first installed Net::SSH::Perl. > >> I think it's down to using perl versions of some of the encryption=20 > >> libraries. > >> I'm afraid I can't remember exactly what I did, but I went through=20 > >> the encryption modules and made sure I have nativley compliled=20 > >> versions. > >> This dramtically reduced my login times as Net::SSH::Perl was'nt=20 > >> having to use perl code to encrypt and decrypt. > >> > >> Hope this helps, > >> > >> Mark > >> > >> -----Original Message----- > >> From: ssh...@li... > >> [mailto:ssh...@li...]=20 > On Behalf=20 > >> Of rkb@i.frys.com > >> Sent: 17 December 2006 06:37 > >> To: ssh...@li... > >> Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > authentication is > >> taking1 minute 40 seconds > >> > >> I'm developing a cgi script that uses Net::SSH::Perl, but=20 > the login=20 > >> authentication is taking 1 minute 40 seconds. As you can imagine,=20 > >> 1:40 too long especially since I will be connecting to 4 servers. > >> > >> Is this a known issue and is there a workaround? > >> >=20 >=20 |
From: rkb@i.frys.com - 2006-12-18 19:35:26
|
Thanks for the suggestions. Another person said that the missing module dependency is Math::BigInt, which is what I think you meant, and I'll give it a try tomorrow when I get into to office. I tried searching the archive, but didn't have much luck, because the whitespace and \n line endings were removed from the postings, which makes it very difficult to read/follow. I assume that the posts display their proper format once you're logged in, but it's not accepting my username and/or password. However, I can login from the "registration page" and change my personal settings, I just can't login to the archive. Ron > > Just about everyone has this issue when they first use the module. The > dependencies are incomplete. You'll need to install GMP::BigInt or > whatever the module is called. Check the archives. Search for GMP or > performance. > > Sander > >> -----Original Message----- >> From: ssh...@li... >> [mailto:ssh...@li...] On >> Behalf Of Thompson, Mark >> Sent: Monday, December 18, 2006 4:43 AM >> To: rkb@i.frys.com; ssh...@li... >> Subject: Re: [Ssh-sftp-perl-users] Net::SSH::Perl login >> authentication is taking1 minute 40 seconds >> >> I had a similar issue when I first installed Net::SSH::Perl. >> I think it's down to using perl versions of some of the >> encryption libraries. >> I'm afraid I can't remember exactly what I did, but I went >> through the encryption modules and made sure I have nativley >> compliled versions. >> This dramtically reduced my login times as Net::SSH::Perl >> was'nt having to use perl code to encrypt and decrypt. >> >> Hope this helps, >> >> Mark >> >> -----Original Message----- >> From: ssh...@li... >> [mailto:ssh...@li...] On >> Behalf Of rkb@i.frys.com >> Sent: 17 December 2006 06:37 >> To: ssh...@li... >> Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login authentication is >> taking1 minute 40 seconds >> >> I'm developing a cgi script that uses Net::SSH::Perl, but the >> login authentication is taking 1 minute 40 seconds. As you >> can imagine, 1:40 too long especially since I will be >> connecting to 4 servers. >> >> Is this a known issue and is there a workaround? >> |
From: Sander P. <San...@da...> - 2006-12-18 16:42:09
|
Just about everyone has this issue when they first use the module. The dependencies are incomplete. You'll need to install GMP::BigInt or whatever the module is called. Check the archives. Search for GMP or performance. Sander=20 > -----Original Message----- > From: ssh...@li...=20 > [mailto:ssh...@li...] On=20 > Behalf Of Thompson, Mark > Sent: Monday, December 18, 2006 4:43 AM > To: rkb@i.frys.com; ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Net::SSH::Perl login=20 > authentication is taking1 minute 40 seconds >=20 > I had a similar issue when I first installed Net::SSH::Perl.=20 > I think it's down to using perl versions of some of the=20 > encryption libraries. > I'm afraid I can't remember exactly what I did, but I went=20 > through the encryption modules and made sure I have nativley=20 > compliled versions. > This dramtically reduced my login times as Net::SSH::Perl=20 > was'nt having to use perl code to encrypt and decrypt. >=20 > Hope this helps, >=20 > Mark=20 >=20 > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On=20 > Behalf Of rkb@i.frys.com > Sent: 17 December 2006 06:37 > To: ssh...@li... > Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login authentication is > taking1 minute 40 seconds >=20 > I'm developing a cgi script that uses Net::SSH::Perl, but the=20 > login authentication is taking 1 minute 40 seconds. As you=20 > can imagine, 1:40 too long especially since I will be=20 > connecting to 4 servers. >=20 > Is this a known issue and is there a workaround? >=20 > Here's my test script and the output. >=20 > #!/usr/bin/perl >=20 > use strict; > use warnings; > use CGI qw/:standard/; > use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use=20 > Net::SSH::Perl; use Data::Dumper; >=20 > $|++; >=20 > my $imap1 =3D 'imap1'; > my %params =3D (debug =3D> 1, protocol =3D> 2); >=20 > print header(), > start_html(), > "creating ssh object: ", scalar localtime, br; >=20 > warningsToBrowser(1); >=20 > my $ssh_imap1 =3D Net::SSH::Perl->new($imap1, %params) || die=20 > "can't ssh $!"; print "ssh object created: ", scalar=20 > localtime, "<br>$/"; >=20 > print "logging in: ", scalar localtime, br;=20 > $ssh_imap1->login('me'); print "logged in: ", scalar localtime, br; >=20 > my ($stdout, $stderr, $exit) =3D $ssh_imap1->cmd('pwd');=20 > $stdout =3D~ s/\n/<br>/g; >=20 > print "<br>$stdout", > end_html(); >=20 > -------------------------------------------------------------- > ---------- > -------------- >=20 > creating ssh object: Sat Dec 16 21:44:04 2006 ssh object=20 > created: Sat Dec 16 21:44:04 2006 logging in: Sat Dec 16=20 > 21:44:04 2006 logged in: Sat Dec 16 21:45:44 2006 >=20 > /home/me >=20 >=20 > -------------------------------------------------------------- > ---------- > - > Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to=20 > share your opinions on IT & business topics through brief=20 > surveys - and earn cash=20 > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge > &CID=3DDEVDE > V > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users >=20 > This e-mail has come from Experian, winner of the UK's=20 > 'Business of the Year' 2003 and 2005. >=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Information in this e-mail and any attachments are=20 > confidential, and may not be copied or used by anyone other=20 > than the addressee, nor disclosed to any third party without=20 > our permission. There is no intention to create any legally=20 > binding contract or other binding commitment through the use=20 > of this electronic communication unless it is issued in=20 > accordance with the Experian Limited standard terms and=20 > conditions of purchase or other express written agreement=20 > between Experian Limited and the recipient Experian Limited=20 > (registration number 653331) Registered office: Talbot House,=20 > Talbot Street, Nottingham NG80 1TH >=20 > Although Experian has taken reasonable steps to ensure that=20 > this communication and any attachments are free from computer=20 > virus, you are advised to take your own steps to ensure that=20 > they are actually virus free. >=20 >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to=20 > share your opinions on IT & business topics through brief=20 > surveys - and earn cash=20 > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge > &CID=3DDEVDEV > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users >=20 |
From: Thompson, M. <Mar...@uk...> - 2006-12-18 09:43:04
|
I had a similar issue when I first installed Net::SSH::Perl. I think it's down to using perl versions of some of the encryption libraries. I'm afraid I can't remember exactly what I did, but I went through the encryption modules and made sure I have nativley compliled versions. This dramtically reduced my login times as Net::SSH::Perl was'nt having to use perl code to encrypt and decrypt. Hope this helps, Mark=20 -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of rkb@i.frys.com Sent: 17 December 2006 06:37 To: ssh...@li... Subject: [Ssh-sftp-perl-users] Net::SSH::Perl login authentication is taking1 minute 40 seconds I'm developing a cgi script that uses Net::SSH::Perl, but the login authentication is taking 1 minute 40 seconds. As you can imagine, 1:40 too long especially since I will be connecting to 4 servers. Is this a known issue and is there a workaround? Here's my test script and the output. #!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Net::SSH::Perl; use Data::Dumper; $|++; my $imap1 =3D 'imap1'; my %params =3D (debug =3D> 1, protocol =3D> 2); print header(), start_html(), "creating ssh object: ", scalar localtime, br; warningsToBrowser(1); my $ssh_imap1 =3D Net::SSH::Perl->new($imap1, %params) || die "can't ssh $!"; print "ssh object created: ", scalar localtime, "<br>$/"; print "logging in: ", scalar localtime, br; $ssh_imap1->login('me'); print "logged in: ", scalar localtime, br; my ($stdout, $stderr, $exit) =3D $ssh_imap1->cmd('pwd'); $stdout =3D~ s/\n/<br>/g; print "<br>$stdout", end_html(); ------------------------------------------------------------------------ -------------- creating ssh object: Sat Dec 16 21:44:04 2006 ssh object created: Sat Dec 16 21:44:04 2006 logging in: Sat Dec 16 21:44:04 2006 logged in: Sat Dec 16 21:45:44 2006 /home/me ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE= VDE V _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users This e-mail has come from Experian, winner of the UK's 'Business of the Yea= r' 2003 and 2005. =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 Information in this e-mail and any attachments are confidential, and may no= t be copied or used by anyone other than the addressee, nor disclosed to an= y third party without our permission. There is no intention to create any l= egally binding contract or other binding commitment through the use of this= electronic communication unless it is issued in accordance with the Experi= an Limited standard terms and conditions of purchase or other express writt= en agreement between Experian Limited and the recipient Experian Limited (r= egistration number 653331) Registered office: Talbot House, Talbot Street, = Nottingham NG80 1TH Although Experian has taken reasonable steps to ensure that this communicat= ion and any attachments are free from computer virus, you are advised to ta= ke your own steps to ensure that they are actually virus free. |
From: rkb@i.frys.com - 2006-12-17 06:36:36
|
I'm developing a cgi script that uses Net::SSH::Perl, but the login authentication is taking 1 minute 40 seconds. As you can imagine, 1:40 too long especially since I will be connecting to 4 servers. Is this a known issue and is there a workaround? Here's my test script and the output. #!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Net::SSH::Perl; use Data::Dumper; $|++; my $imap1 = 'imap1'; my %params = (debug => 1, protocol => 2); print header(), start_html(), "creating ssh object: ", scalar localtime, br; warningsToBrowser(1); my $ssh_imap1 = Net::SSH::Perl->new($imap1, %params) || die "can't ssh $!"; print "ssh object created: ", scalar localtime, "<br>$/"; print "logging in: ", scalar localtime, br; $ssh_imap1->login('me'); print "logged in: ", scalar localtime, br; my ($stdout, $stderr, $exit) = $ssh_imap1->cmd('pwd'); $stdout =~ s/\n/<br>/g; print "<br>$stdout", end_html(); -------------------------------------------------------------------------------------- creating ssh object: Sat Dec 16 21:44:04 2006 ssh object created: Sat Dec 16 21:44:04 2006 logging in: Sat Dec 16 21:44:04 2006 logged in: Sat Dec 16 21:45:44 2006 /home/me |
From: <ark...@ap...> - 2006-11-29 20:19:50
|
Folks, I am using NET:SFTP module for transferring files. But if I press <ENTER> key during SFTP work my scripts died with error message: Connection closed at <filename> line <line> Can somebody help me? Why this happened? Here is the debug log: arkh-linux-ibm.localdomain: Reading configuration data /home/nortel/.ssh/config arkh-linux-ibm.localdomain: Reading configuration data /etc/ssh_config arkh-linux-ibm.localdomain: Connecting to 47.11.67.30, port 22. arkh-linux-ibm.localdomain: Remote version string: SSH-1.99-OpenSSH_3.9p1 arkh-linux-ibm.localdomain: Remote protocol version 1.99, remote software version OpenSSH_3.9p1 arkh-linux-ibm.localdomain: Net::SSH::Perl Version 1.30, protocol version 2.0. arkh-linux-ibm.localdomain: No compat match: OpenSSH_3.9p1. arkh-linux-ibm.localdomain: Connection established. arkh-linux-ibm.localdomain: Sent key-exchange init (KEXINIT), wait response. arkh-linux-ibm.localdomain: Algorithms, c->s: 3des-cbc hmac-sha1 none arkh-linux-ibm.localdomain: Algorithms, s->c: 3des-cbc hmac-sha1 none arkh-linux-ibm.localdomain: Entering Diffie-Hellman Group 1 key exchange. arkh-linux-ibm.localdomain: Sent DH public key, waiting for reply. arkh-linux-ibm.localdomain: Received host key, type 'ssh-dss'. arkh-linux-ibm.localdomain: Host '47.11.67.30' is known and matches the host key. arkh-linux-ibm.localdomain: Computing shared secret key. arkh-linux-ibm.localdomain: Verifying server signature. arkh-linux-ibm.localdomain: Waiting for NEWKEYS message. arkh-linux-ibm.localdomain: Enabling incoming encryption/MAC/compression. arkh-linux-ibm.localdomain: Send NEWKEYS, enable outgoing encryption/MAC/compression. arkh-linux-ibm.localdomain: Sending request for user-authentication service. arkh-linux-ibm.localdomain: Service accepted: ssh-userauth. arkh-linux-ibm.localdomain: Trying empty user-authentication request. arkh-linux-ibm.localdomain: Authentication methods that can continue: publickey,gssapi-with-mic,password. arkh-linux-ibm.localdomain: Next method to try is publickey. arkh-linux-ibm.localdomain: Next method to try is password. arkh-linux-ibm.localdomain: Trying password authentication. arkh-linux-ibm.localdomain: Login completed, opening dummy shell channel. arkh-linux-ibm.localdomain: channel 0: new [client-session] arkh-linux-ibm.localdomain: Requesting channel_open for channel 0. arkh-linux-ibm.localdomain: channel 0: open confirm rwindow 0 rmax 32768 arkh-linux-ibm.localdomain: Got channel open confirmation, requesting shell. arkh-linux-ibm.localdomain: Requesting service shell on channel 0. arkh-linux-ibm.localdomain: channel 1: new [client-session] arkh-linux-ibm.localdomain: Requesting channel_open for channel 1. arkh-linux-ibm.localdomain: Sending subsystem: sftp arkh-linux-ibm.localdomain: Requesting service subsystem on channel 1. arkh-linux-ibm.localdomain: channel 1: open confirm rwindow 0 rmax 32768 arkh-linux-ibm.localdomain: sftp: Sending SSH2_FXP_INIT arkh-linux-ibm.localdomain: sftp: Remote version: 3 arkh-linux-ibm.localdomain: sftp: Sent message T:17 I:0 arkh-linux-ibm.localdomain: channel 1: rcvd eof arkh-linux-ibm.localdomain: channel 1: output open -> drain arkh-linux-ibm.localdomain: channel 1: obuf empty arkh-linux-ibm.localdomain: channel 1: output drain -> closed arkh-linux-ibm.localdomain: channel 1: close_write arkh-linux-ibm.localdomain: !!!type=98 arkh-linux-ibm.localdomain: !!!type=97 arkh-linux-ibm.localdomain: channel 1: rcvd close arkh-linux-ibm.localdomain: channel 1: input open -> closed arkh-linux-ibm.localdomain: channel 1: close_read arkh-linux-ibm.localdomain: channel 1: send close arkh-linux-ibm.localdomain: channel 1: full closed It looks like EOF received but WHY? Thank you in advance. Simeon |
From: DonKiShoot <don...@wa...> - 2006-11-29 08:45:02
|
I try command with success. Maybe it is important but as you see in my debug the switch ask to press=20 enter when login in to access cli : [root@srv78supervision ~]# ssh -vvv -l operator 10.1.2.22 OpenSSH_4.3p2, OpenSSL 0.9.8a 11 Oct 2005 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to 10.1.2.22 [10.1.2.22] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug3: Not a RSA1 key file /root/.ssh/id_dsa. debug2: key_type_from_name: unknown key type '-----BEGIN' debug3: key_read: missing keytype debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug2: key_type_from_name: unknown key type '-----END' debug3: key_read: missing keytype debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_3.7.= 1p2 debug1: match: OpenSSH_3.7.1p2 pat OpenSSH_3.* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.3 debug2: fd 3 setting O_NONBLOCK debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: kex_parse_kexinit:=20 diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hel= lman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa,ssh-dss debug2: kex_parse_kexinit:=20 aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfou= r,aes192-cbc,aes256-cbc,r debug2: kex_parse_kexinit:=20 aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfou= r,aes192-cbc,aes256-cbc,r debug2: kex_parse_kexinit:=20 hmac-md5,hmac-sha1,hmac-ripemd160,hma...@op...,hmac-sha1-96= ,hmac-md5-96 debug2: kex_parse_kexinit:=20 hmac-md5,hmac-sha1,hmac-ripemd160,hma...@op...,hmac-sha1-96= ,hmac-md5-96 debug2: kex_parse_kexinit: none,zl...@op...,zlib debug2: kex_parse_kexinit: none,zl...@op...,zlib debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: kex_parse_kexinit:=20 diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa debug2: kex_parse_kexinit: des,3des-cbc debug2: kex_parse_kexinit: des,3des-cbc debug2: kex_parse_kexinit:=20 hmac-md5,hmac-sha1,hmac-ripemd160,hma...@op...,hmac-sha1-96= ,hmac-md5-96 debug2: kex_parse_kexinit:=20 hmac-md5,hmac-sha1,hmac-ripemd160,hma...@op...,hmac-sha1-96= ,hmac-md5-96 debug2: kex_parse_kexinit: none debug2: kex_parse_kexinit: none debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: mac_init: found hmac-md5 debug1: kex: server->client 3des-cbc hmac-md5 none debug2: mac_init: found hmac-md5 debug1: kex: client->server 3des-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug2: dh_gen_key: priv key bits set: 189/384 debug2: bits set: 1578/3191 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts2 debug3: check_host_in_hostfile: match line 1 debug1: Host '10.1.2.22' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts2:1 debug2: bits set: 1588/3191 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /root/.ssh/identity ((nil)) debug2: key: /root/.ssh/id_rsa ((nil)) debug2: key: /root/.ssh/id_dsa ((nil)) debug3: input_userauth_banner debug1: Authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug3: no such identity: /root/.ssh/identity debug1: Trying private key: /root/.ssh/id_rsa debug3: no such identity: /root/.ssh/id_rsa debug1: Trying private key: /root/.ssh/id_dsa debug1: read PEM private key done: type DSA debug3: sign_and_send_pubkey debug2: we sent a publickey packet, wait for reply debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug2: channel 0: send open debug1: Entering interactive session. debug2: callback start debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 0 debug3: tty_make_modes: ospeed 38400 debug3: tty_make_modes: ispeed 38400 debug3: tty_make_modes: 1 3 debug3: tty_make_modes: 2 28 debug3: tty_make_modes: 3 127 debug3: tty_make_modes: 4 21 debug3: tty_make_modes: 5 4 debug3: tty_make_modes: 6 0 debug3: tty_make_modes: 7 0 debug3: tty_make_modes: 8 17 debug3: tty_make_modes: 9 19 debug3: tty_make_modes: 10 26 debug3: tty_make_modes: 12 18 debug3: tty_make_modes: 13 23 debug3: tty_make_modes: 14 22 debug3: tty_make_modes: 18 15 debug3: tty_make_modes: 30 0 debug3: tty_make_modes: 31 0 debug3: tty_make_modes: 32 0 debug3: tty_make_modes: 33 0 debug3: tty_make_modes: 34 0 debug3: tty_make_modes: 35 0 debug3: tty_make_modes: 36 1 debug3: tty_make_modes: 37 0 debug3: tty_make_modes: 38 1 debug3: tty_make_modes: 39 0 debug3: tty_make_modes: 40 0 debug3: tty_make_modes: 41 0 debug3: tty_make_modes: 50 1 debug3: tty_make_modes: 51 1 debug3: tty_make_modes: 52 0 debug3: tty_make_modes: 53 1 debug3: tty_make_modes: 54 1 debug3: tty_make_modes: 55 1 debug3: tty_make_modes: 56 0 debug3: tty_make_modes: 57 0 debug3: tty_make_modes: 58 0 debug3: tty_make_modes: 59 1 debug3: tty_make_modes: 60 1 debug3: tty_make_modes: 61 1 debug3: tty_make_modes: 62 0 debug3: tty_make_modes: 70 1 debug3: tty_make_modes: 71 0 debug3: tty_make_modes: 72 1 debug3: tty_make_modes: 73 0 debug3: tty_make_modes: 74 0 debug3: tty_make_modes: 75 0 debug3: tty_make_modes: 90 1 debug3: tty_make_modes: 91 1 debug3: tty_make_modes: 92 0 debug3: tty_make_modes: 93 0 debug1: Sending environment. debug3: Ignored env HOSTNAME debug3: Ignored env TERM debug3: Ignored env SHELL debug3: Ignored env HISTSIZE debug3: Ignored env SSH_CLIENT debug3: Ignored env SSH_TTY debug3: Ignored env USER debug3: Ignored env LS_COLORS debug3: Ignored env DSM_DIR debug3: Ignored env MIBS debug3: Ignored env MAIL debug3: Ignored env PATH debug3: Ignored env INPUTRC debug3: Ignored env PWD debug1: Sending env LANG =3D fr_FR.UTF-8 debug2: channel 0: request env confirm 0 debug3: Ignored env DSM_CONFIG debug3: Ignored env SSH_ASKPASS debug3: Ignored env SHLVL debug3: Ignored env HOME debug3: Ignored env LOGNAME debug3: Ignored env SSH_CONNECTION debug3: Ignored env LESSOPEN debug3: Ignored env G_BROKEN_FILENAMES debug3: Ignored env _ debug2: channel 0: request shell confirm 0 debug2: fd 3 setting TCP_NODELAY debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 131072 #########################################################################= ### ProCurve J4899A Switch 2650 Software revision H.08.106 Copyright (C) 1991-2006 Hewlett-Packard Co. All Rights Reserved. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the Government is subject to=20 restrictions as set forth in subdivision (b) (3) (ii) of the Rights in Technical=20 Data and Computer Software clause at 52.227-7013. HEWLETT-PACKARD COMPANY, 3000 Hanover St., Palo Alto, CA 94303 Press any key to continue ##################################################################### ### Then i press enter SW-1>exit debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cfd -1) debug3: channel 0: close_fds r 4 w 5 e 6 c -1 Connection to 10.1.2.22 closed by remote host. Connection to 10.1.2.22 closed. debug1: Transferred: stdin 0, stdout 0, stderr 81 bytes in 60.7 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 1.3 debug1: Exit status -1 Thank you another time for your help to resolve this problem. ;) Heinrich, Matthew a =E9crit : > It may be a bug / feature of your HP Procurve... I wonder if it interp= reted the channel 0 shell request as the actual shell request.... > > Normally, when I look at the debug output, right after "Entering intera= ctive sessions", my client will request a pty and then the shell. > > Can you manually get on with ssh? What do you see from the debug outpu= t of: > > ssh -vvv -l operator 10.1.2.22 > > ? > > -----Original Message----- > From: DonKiShoot [mailto:don...@wa...]=20 > Sent: Tuesday, November 28, 2006 3:48 AM > To: Heinrich, Matthew > Cc: ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Device does not support shell reques= tnotpreceded by pty request > > Thank you very much for your response. > > Your solution seems to be a bit more complex but i decided to try it be= cause i don't want to remain on a failure ;) > > First, i used this script to join my hp procurve 2650 as you suggest me= : > > #!/usr/bin/perl -w > use strict; > use Net::SSH::Perl; > my $ssh =3D Net::SSH::Perl->new('10.1.2.22','debug' =3D> 1); $ssh->logi= n('operator'); $ssh->shell(); > > But, i've always got the same bug : > > [root@srv78supervision ~]# ./connect.pl > srv78supervision: Reading configuration data /root/.ssh/config > srv78supervision: Reading configuration data /etc/ssh_config > srv78supervision: Allocated local port 1023. > srv78supervision: Connecting to 10.1.2.22, port 22. > srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 > > srv78supervision: Remote protocol version 2.0, remote software version > OpenSSH_3.7.1p2 > srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. > srv78supervision: No compat match: OpenSSH_3.7.1p2. > srv78supervision: Connection established. > srv78supervision: Sent key-exchange init (KEXINIT), wait response. > srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none > srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none > srv78supervision: Entering Diffie-Hellman Group 1 key exchange. > srv78supervision: Sent DH public key, waiting for reply. > srv78supervision: Received host key, type 'ssh-rsa'. > srv78supervision: Host '10.1.2.22' is known and matches the host key. > srv78supervision: Computing shared secret key. > srv78supervision: Verifying server signature. > srv78supervision: Waiting for NEWKEYS message. > srv78supervision: Enabling incoming encryption/MAC/compression. > srv78supervision: Send NEWKEYS, enable outgoing encryption/MAC/compress= ion. > srv78supervision: Sending request for user-authentication service. > srv78supervision: Service accepted: ssh-userauth. > srv78supervision: Trying empty user-authentication request. > srv78supervision: Authentication methods that can continue:=20 > publickey,password. > srv78supervision: Next method to try is publickey. > srv78supervision: Trying pubkey authentication with key file '/root/.ss= h/id_dsa' > srv78supervision: Login completed, opening dummy shell channel. > srv78supervision: channel 0: new [client-session] > srv78supervision: Requesting channel_open for channel 0. > srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 > srv78supervision: Got channel open confirmation, requesting shell. > srv78supervision: Requesting service shell on channel 0. > srv78supervision: channel 1: new [client-session] > srv78supervision: Requesting channel_open for channel 1. > srv78supervision: Entering interactive session. > Received disconnect message: Device does not support shell request not = preceded by pty request. > at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284 > > Do you think that this bug come from HP Procurve 2650 ? > It's not my first problem with this material (storm broadcasting for ex= emple), i believe that this IOS is a piece of chit !!! > > No more idea ? Must i give up ? > > Heinrich, Matthew a =E9crit : > =20 >> =20 >> >> Looks like some of the formatting got messed up in transit... =20 >> >> >> -----Original Message----- >> From: ssh...@li... >> [mailto:ssh...@li...] On Behalf=20 >> Of Heinrich, Matthew >> Sent: Monday, November 27, 2006 4:52 PM >> To: DonKiShoot; ssh...@li... >> Subject: Re: [Ssh-sftp-perl-users] Device does not support shell=20 >> requestnotpreceded by pty request >> >> I have been working on the same sort of problem for a while now. I=20 >> was getting this same error because the "cmd" function of=20 >> Net::SSH::Perl will always expect an exit code, and the devices to=20 >> which we are communicating do not support exit codes after each=20 >> command. Also, the device prefers to have all commands sent through=20 >> the same channel, and Net::SSH::Perl will open a new channel for each=20 >> command when using SSHv2. >> >> At first, I tried copying "sub cmd" to "sub ccmd" and making it use=20 >> the same channel, but I could not get the buffers to work properly. A= =20 >> lot of people said to use an Expect script, but that didn't seem like=20 >> good idea, until I took a look at the Expect Perl module... >> >> I created a connecting script (connect.pl) which will login and get me= =20 >> to an interactive prompt: >> >> ---------------------------------------------------------------------- >> -- >> -------- >> #!/usr/bin/perl >> >> use strict; >> use Net::SSH::Perl; >> >> my $host =3D "a.b.c.d"; >> my $user =3D "uname"; >> my $pass =3D "pword"; >> >> my $ssh =3D Net::SSH::Perl->new($host, port=3D>22); $ssh->login($user,= =20 >> $pass); $ssh->shell(); >> ---------------------------------------------------------------------- >> -- >> -------- >> >> >> Next, I created the main Perl script using the Expect module, spawning= =20 >> this connection program: >> >> >> ---------------------------------------------------------------------- >> -- >> -------- >> #!/usr/bin/perl >> >> use Expect; >> >> $| =3D 1; # Auto flush output >> >> my $exp =3D Expect->new(); >> >> # Prevent local echo from showing in results $exp->raw_pty(1); >> >> # Run connector program >> $exp->spawn("./connect.pl"); >> >> # Prevent output from going to STDOUT >> (*$exp)->{exp_Log_Stdout} =3D 0; >> >> # Wait for initial prompt (30 sec timeout) $exp->expect(30,=20 >> "centerpoint>"); >> >> # Send command with no output needed >> snd("set rows 0"); >> >> print "Sending remote command..."; >> >> # Send command, store output in @res array @res =3D snd("show vss"); >> >> print "OK\n\nResults:\n"; >> >> # List output line-by-line >> foreach $n (0..$#res) { >> print "$n: @res[$n]\n"; >> } >> >> $exp->send("exit\n"); >> $exp->soft_close(); >> >> # This makes sending multiple commands much easier. Instead of #=20 >> using multiple "send" and "expect" calls manually, just use snd >> >> sub snd ($){ >> $exp->send(@_[0] . "\n"); >> >> # Use the "-re" option to specify regular expression, as >> # opposed to an exact pattern match. Otherwise, you can=20 >> # just list 2 arguments (timeout, pattern match) >> my @out =3D $exp->expect(10, "-re", 'centerpoint>$'); >> my @newout =3D split(/\n/, @out[3]); >> >> # Remove first line (in my case, it shows the command I typed, >> # which is not needed in the resulting output) >> shift @newout; >> >> return wantarray ? @newout : 1; } >> ---------------------------------------------------------------------- >> -- >> -------- >> >> >> This script will wait for connect.pl to present the CLI prompt (in=20 >> this case, it shows "centerpoint>"), and will be able to interact with= =20 >> the SSH session more easily than if you modified Net::SSH::Perl, or if= =20 >> you used TCL Expect. >> >> >> -----Original Message----- >> From: ssh...@li... >> [mailto:ssh...@li...] On Behalf=20 >> Of DonKiShoot >> Sent: Wednesday, November 22, 2006 8:16 AM >> To: ssh...@li... >> Subject: Re: [Ssh-sftp-perl-users] Device does not support shell=20 >> request notpreceded by pty request >> >> Hello all, >> >> I'm trying to send some commands to my switch HP Procurve 2650 in ssh2= =20 >> with Net::SSH::Perl with user 'operator' and pubkey authentification. >> It appears that i have a problem when starting to send command but=20 >> authentification seems good. >> >> This is sample of my perl script and next debug trace with error i >> receive: >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> foreach my $addr (keys %Switch) { >> # print "$addr, $Switch{$addr}{'login'} :\n"; >> my $ssh =3D Net::SSH::Perl->new($addr,'debug' =3D> 1, 'use_pty' =3D= > 1,=20 >> 'protocol' =3D> 2, 'interactive' =3D> 0, options =3D> ["RhostsAuthenti= cation=20 >> no"]); >> >> #$ssh->register_handler("stdout", sub { >> # my($channel, $buffer) =3D @_; >> # print "I received this: ", $buffer->bytes; >> # }); >> >> $ssh->login($Switch{$addr}{'login'}); >> >> my($stdout, $stderr, $exit) =3D $ssh->cmd("\n"); >> print "$stdout $stderr $exit\n"; >> ($stdout, $stderr, $exit) =3D $ssh->cmd("ping $ip"); >> print "$stdout $stderr $exit\n"; >> } >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> srv78supervision: Reading configuration data /root/.ssh/config >> srv78supervision: Reading configuration data /etc/ssh_config >> srv78supervision: Allocated local port 1023. >> srv78supervision: Connecting to 10.1.2.22, port 22. >> srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 >> >> srv78supervision: Remote protocol version 2.0, remote software version >> OpenSSH_3.7.1p2 >> srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. >> srv78supervision: No compat match: OpenSSH_3.7.1p2. >> srv78supervision: Connection established. >> srv78supervision: Sent key-exchange init (KEXINIT), wait response. >> srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none >> srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none >> srv78supervision: Entering Diffie-Hellman Group 1 key exchange. >> srv78supervision: Sent DH public key, waiting for reply. >> srv78supervision: Received host key, type 'ssh-rsa'. >> srv78supervision: Host '10.1.2.22' is known and matches the host key. >> srv78supervision: Computing shared secret key. >> srv78supervision: Verifying server signature. >> srv78supervision: Waiting for NEWKEYS message. >> srv78supervision: Enabling incoming encryption/MAC/compression. >> srv78supervision: Send NEWKEYS, enable outgoing=20 >> encryption/MAC/compression. >> srv78supervision: Sending request for user-authentication service. >> srv78supervision: Service accepted: ssh-userauth. >> srv78supervision: Trying empty user-authentication request. >> srv78supervision: Authentication methods that can continue:=20 >> publickey,password. >> srv78supervision: Next method to try is publickey. >> srv78supervision: Trying pubkey authentication with key file=20 >> '/root/.ssh/id_dsa' >> srv78supervision: Login completed, opening dummy shell channel. >> srv78supervision: channel 0: new [client-session] >> srv78supervision: Requesting channel_open for channel 0. >> srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 >> srv78supervision: Got channel open confirmation, requesting shell. >> srv78supervision: Requesting service shell on channel 0. >> srv78supervision: channel 1: new [client-session] >> srv78supervision: Requesting channel_open for channel 1. >> srv78supervision: Entering interactive session. >> /*Received disconnect message: Device does not support shell request=20 >> not preceded by pty request. >> at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284*/ >> >> What can i do to resolve this problem ? >> >> Thx all >> >> >> >> >> ---------------------------------------------------------------------- >> -- >> - >> Take Surveys. Earn Cash. Influence the Future of IT Join=20 >> SourceForge.net's Techsay panel and you'll get the chance to share=20 >> your opinions on IT & business topics through brief surveys - and earn= =20 >> cash=20 >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEV >> DE >> V >> _______________________________________________ >> Ssh-sftp-perl-users mailing list >> Ssh...@li... >> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users >> >> ---------------------------------------------------------------------- >> -- >> - >> Take Surveys. Earn Cash. Influence the Future of IT Join=20 >> SourceForge.net's Techsay panel and you'll get the chance to share=20 >> your opinions on IT & business topics through brief surveys - and earn= =20 >> cash=20 >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEV >> DE >> V >> _______________________________________________ >> Ssh-sftp-perl-users mailing list >> Ssh...@li... >> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users >> >> >> =20 >> =20 > > > =20 |
From: Heinrich, M. <Mat...@sa...> - 2006-11-28 23:08:14
|
This looks more like an error coming from the remote OS, as this does not appear to be a standard SSH message. If the passwd utility works when you are on a normal SSH session, then perhaps there is something wrong with the way data is being transmitted across the channel ________________________________ From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Nielsen, Jens W. Sent: Tuesday, November 28, 2006 4:55 PM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Problem with using the passwd command I have been using the remoteinteract2.pl example to try to change the password remotely. However, I keep getting a "Unexpected failure. Password file/table unchanged." Message when I try this. Below is the printout (with the response from the command listed). Any ideas what may be causing this? pstrain: Sending command: passwd pstrain: Requesting service exec on channel 3. pstrain: channel 3: open confirm rwindow 0 rmax 32768 pstrain: channel 3: rcvd eof pstrain: channel 3: output open -> drain pstrain: input_channel_request: rtype exit-status reply 0 pstrain: channel 3: rcvd close pstrain: channel 3: input open -> closed pstrain: channel 3: close_read Response: Unexpected failure. Password file/table unchanged. =20 pstrain: channel 3: obuf empty pstrain: channel 3: output drain -> closed pstrain: channel 3: close_write pstrain: channel 3: send close pstrain: channel 3: full closed |
From: Nielsen, J. W. <jwn...@ca...> - 2006-11-28 22:55:31
|
I have been using the remoteinteract2.pl example to try to change the password remotely. However, I keep getting a "Unexpected failure. Password file/table unchanged." Message when I try this. Below is the printout (with the response from the command listed). Any ideas what may be causing this? pstrain: Sending command: passwd pstrain: Requesting service exec on channel 3. pstrain: channel 3: open confirm rwindow 0 rmax 32768 pstrain: channel 3: rcvd eof pstrain: channel 3: output open -> drain pstrain: input_channel_request: rtype exit-status reply 0 pstrain: channel 3: rcvd close pstrain: channel 3: input open -> closed pstrain: channel 3: close_read Response: Unexpected failure. Password file/table unchanged. =20 pstrain: channel 3: obuf empty pstrain: channel 3: output drain -> closed pstrain: channel 3: close_write pstrain: channel 3: send close pstrain: channel 3: full closed |
From: Heinrich, M. <Mat...@sa...> - 2006-11-28 19:04:33
|
It may be a bug / feature of your HP Procurve... I wonder if it = interpreted the channel 0 shell request as the actual shell request.... Normally, when I look at the debug output, right after "Entering = interactive sessions", my client will request a pty and then the shell. Can you manually get on with ssh? What do you see from the debug output = of: ssh -vvv -l operator 10.1.2.22 ? -----Original Message----- From: DonKiShoot [mailto:don...@wa...]=20 Sent: Tuesday, November 28, 2006 3:48 AM To: Heinrich, Matthew Cc: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Device does not support shell = requestnotpreceded by pty request Thank you very much for your response. Your solution seems to be a bit more complex but i decided to try it = because i don't want to remain on a failure ;) First, i used this script to join my hp procurve 2650 as you suggest me = : #!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $ssh =3D Net::SSH::Perl->new('10.1.2.22','debug' =3D> 1); = $ssh->login('operator'); $ssh->shell(); But, i've always got the same bug : [root@srv78supervision ~]# ./connect.pl srv78supervision: Reading configuration data /root/.ssh/config srv78supervision: Reading configuration data /etc/ssh_config srv78supervision: Allocated local port 1023. srv78supervision: Connecting to 10.1.2.22, port 22. srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 srv78supervision: Remote protocol version 2.0, remote software version OpenSSH_3.7.1p2 srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. srv78supervision: No compat match: OpenSSH_3.7.1p2. srv78supervision: Connection established. srv78supervision: Sent key-exchange init (KEXINIT), wait response. srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none srv78supervision: Entering Diffie-Hellman Group 1 key exchange. srv78supervision: Sent DH public key, waiting for reply. srv78supervision: Received host key, type 'ssh-rsa'. srv78supervision: Host '10.1.2.22' is known and matches the host key. srv78supervision: Computing shared secret key. srv78supervision: Verifying server signature. srv78supervision: Waiting for NEWKEYS message. srv78supervision: Enabling incoming encryption/MAC/compression. srv78supervision: Send NEWKEYS, enable outgoing = encryption/MAC/compression. srv78supervision: Sending request for user-authentication service. srv78supervision: Service accepted: ssh-userauth. srv78supervision: Trying empty user-authentication request. srv78supervision: Authentication methods that can continue:=20 publickey,password. srv78supervision: Next method to try is publickey. srv78supervision: Trying pubkey authentication with key file = '/root/.ssh/id_dsa' srv78supervision: Login completed, opening dummy shell channel. srv78supervision: channel 0: new [client-session] srv78supervision: Requesting channel_open for channel 0. srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 srv78supervision: Got channel open confirmation, requesting shell. srv78supervision: Requesting service shell on channel 0. srv78supervision: channel 1: new [client-session] srv78supervision: Requesting channel_open for channel 1. srv78supervision: Entering interactive session. Received disconnect message: Device does not support shell request not = preceded by pty request. at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284 Do you think that this bug come from HP Procurve 2650 ? It's not my first problem with this material (storm broadcasting for = exemple), i believe that this IOS is a piece of chit !!! No more idea ? Must i give up ? Heinrich, Matthew a =E9crit : > =20 > > Looks like some of the formatting got messed up in transit... =20 > > > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On Behalf=20 > Of Heinrich, Matthew > Sent: Monday, November 27, 2006 4:52 PM > To: DonKiShoot; ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Device does not support shell=20 > requestnotpreceded by pty request > > I have been working on the same sort of problem for a while now. I=20 > was getting this same error because the "cmd" function of=20 > Net::SSH::Perl will always expect an exit code, and the devices to=20 > which we are communicating do not support exit codes after each=20 > command. Also, the device prefers to have all commands sent through=20 > the same channel, and Net::SSH::Perl will open a new channel for each=20 > command when using SSHv2. > > At first, I tried copying "sub cmd" to "sub ccmd" and making it use=20 > the same channel, but I could not get the buffers to work properly. A = > lot of people said to use an Expect script, but that didn't seem like=20 > good idea, until I took a look at the Expect Perl module... > > I created a connecting script (connect.pl) which will login and get me = > to an interactive prompt: > > ---------------------------------------------------------------------- > -- > -------- > #!/usr/bin/perl > > use strict; > use Net::SSH::Perl; > > my $host =3D "a.b.c.d"; > my $user =3D "uname"; > my $pass =3D "pword"; > > my $ssh =3D Net::SSH::Perl->new($host, port=3D>22); $ssh->login($user, = > $pass); $ssh->shell(); > ---------------------------------------------------------------------- > -- > -------- > > > Next, I created the main Perl script using the Expect module, spawning = > this connection program: > > > ---------------------------------------------------------------------- > -- > -------- > #!/usr/bin/perl > > use Expect; > > $| =3D 1; # Auto flush output > > my $exp =3D Expect->new(); > > # Prevent local echo from showing in results $exp->raw_pty(1); > > # Run connector program > $exp->spawn("./connect.pl"); > > # Prevent output from going to STDOUT > (*$exp)->{exp_Log_Stdout} =3D 0; > > # Wait for initial prompt (30 sec timeout) $exp->expect(30,=20 > "centerpoint>"); > > # Send command with no output needed > snd("set rows 0"); > > print "Sending remote command..."; > > # Send command, store output in @res array @res =3D snd("show vss"); > > print "OK\n\nResults:\n"; > > # List output line-by-line > foreach $n (0..$#res) { > print "$n: @res[$n]\n"; > } > > $exp->send("exit\n"); > $exp->soft_close(); > > # This makes sending multiple commands much easier. Instead of #=20 > using multiple "send" and "expect" calls manually, just use snd > > sub snd ($){ > $exp->send(@_[0] . "\n"); > > # Use the "-re" option to specify regular expression, as > # opposed to an exact pattern match. Otherwise, you can=20 > # just list 2 arguments (timeout, pattern match) > my @out =3D $exp->expect(10, "-re", 'centerpoint>$'); > my @newout =3D split(/\n/, @out[3]); > > # Remove first line (in my case, it shows the command I typed, > # which is not needed in the resulting output) > shift @newout; > > return wantarray ? @newout : 1; } > ---------------------------------------------------------------------- > -- > -------- > > > This script will wait for connect.pl to present the CLI prompt (in=20 > this case, it shows "centerpoint>"), and will be able to interact with = > the SSH session more easily than if you modified Net::SSH::Perl, or if = > you used TCL Expect. > > > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On Behalf=20 > Of DonKiShoot > Sent: Wednesday, November 22, 2006 8:16 AM > To: ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Device does not support shell=20 > request notpreceded by pty request > > Hello all, > > I'm trying to send some commands to my switch HP Procurve 2650 in ssh2 = > with Net::SSH::Perl with user 'operator' and pubkey authentification. > It appears that i have a problem when starting to send command but=20 > authentification seems good. > > This is sample of my perl script and next debug trace with error i > receive: > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > foreach my $addr (keys %Switch) { > # print "$addr, $Switch{$addr}{'login'} :\n"; > my $ssh =3D Net::SSH::Perl->new($addr,'debug' =3D> 1, 'use_pty' = =3D> 1,=20 > 'protocol' =3D> 2, 'interactive' =3D> 0, options =3D> = ["RhostsAuthentication=20 > no"]); > > #$ssh->register_handler("stdout", sub { > # my($channel, $buffer) =3D @_; > # print "I received this: ", $buffer->bytes; > # }); > > $ssh->login($Switch{$addr}{'login'}); > > my($stdout, $stderr, $exit) =3D $ssh->cmd("\n"); > print "$stdout $stderr $exit\n"; > ($stdout, $stderr, $exit) =3D $ssh->cmd("ping $ip"); > print "$stdout $stderr $exit\n"; > } > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > srv78supervision: Reading configuration data /root/.ssh/config > srv78supervision: Reading configuration data /etc/ssh_config > srv78supervision: Allocated local port 1023. > srv78supervision: Connecting to 10.1.2.22, port 22. > srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 > > srv78supervision: Remote protocol version 2.0, remote software version > OpenSSH_3.7.1p2 > srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. > srv78supervision: No compat match: OpenSSH_3.7.1p2. > srv78supervision: Connection established. > srv78supervision: Sent key-exchange init (KEXINIT), wait response. > srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none > srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none > srv78supervision: Entering Diffie-Hellman Group 1 key exchange. > srv78supervision: Sent DH public key, waiting for reply. > srv78supervision: Received host key, type 'ssh-rsa'. > srv78supervision: Host '10.1.2.22' is known and matches the host key. > srv78supervision: Computing shared secret key. > srv78supervision: Verifying server signature. > srv78supervision: Waiting for NEWKEYS message. > srv78supervision: Enabling incoming encryption/MAC/compression. > srv78supervision: Send NEWKEYS, enable outgoing=20 > encryption/MAC/compression. > srv78supervision: Sending request for user-authentication service. > srv78supervision: Service accepted: ssh-userauth. > srv78supervision: Trying empty user-authentication request. > srv78supervision: Authentication methods that can continue:=20 > publickey,password. > srv78supervision: Next method to try is publickey. > srv78supervision: Trying pubkey authentication with key file=20 > '/root/.ssh/id_dsa' > srv78supervision: Login completed, opening dummy shell channel. > srv78supervision: channel 0: new [client-session] > srv78supervision: Requesting channel_open for channel 0. > srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 > srv78supervision: Got channel open confirmation, requesting shell. > srv78supervision: Requesting service shell on channel 0. > srv78supervision: channel 1: new [client-session] > srv78supervision: Requesting channel_open for channel 1. > srv78supervision: Entering interactive session. > /*Received disconnect message: Device does not support shell request=20 > not preceded by pty request. > at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284*/ > > What can i do to resolve this problem ? > > Thx all > > > > > ---------------------------------------------------------------------- > -- > - > Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to share=20 > your opinions on IT & business topics through brief surveys - and earn = > cash=20 > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEV > DE > V > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > ---------------------------------------------------------------------- > -- > - > Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to share=20 > your opinions on IT & business topics through brief surveys - and earn = > cash=20 > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEV > DE > V > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > =20 |
From: DonKiShoot <don...@wa...> - 2006-11-28 09:48:53
|
Thank you very much for your response. Your solution seems to be a bit more complex but i decided to try it=20 because i don't want to remain on a failure ;) First, i used this script to join my hp procurve 2650 as you suggest me : #!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $ssh =3D Net::SSH::Perl->new('10.1.2.22','debug' =3D> 1); $ssh->login('operator'); $ssh->shell(); But, i've always got the same bug : [root@srv78supervision ~]# ./connect.pl srv78supervision: Reading configuration data /root/.ssh/config srv78supervision: Reading configuration data /etc/ssh_config srv78supervision: Allocated local port 1023. srv78supervision: Connecting to 10.1.2.22, port 22. srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 srv78supervision: Remote protocol version 2.0, remote software version=20 OpenSSH_3.7.1p2 srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. srv78supervision: No compat match: OpenSSH_3.7.1p2. srv78supervision: Connection established. srv78supervision: Sent key-exchange init (KEXINIT), wait response. srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none srv78supervision: Entering Diffie-Hellman Group 1 key exchange. srv78supervision: Sent DH public key, waiting for reply. srv78supervision: Received host key, type 'ssh-rsa'. srv78supervision: Host '10.1.2.22' is known and matches the host key. srv78supervision: Computing shared secret key. srv78supervision: Verifying server signature. srv78supervision: Waiting for NEWKEYS message. srv78supervision: Enabling incoming encryption/MAC/compression. srv78supervision: Send NEWKEYS, enable outgoing encryption/MAC/compressio= n. srv78supervision: Sending request for user-authentication service. srv78supervision: Service accepted: ssh-userauth. srv78supervision: Trying empty user-authentication request. srv78supervision: Authentication methods that can continue:=20 publickey,password. srv78supervision: Next method to try is publickey. srv78supervision: Trying pubkey authentication with key file=20 '/root/.ssh/id_dsa' srv78supervision: Login completed, opening dummy shell channel. srv78supervision: channel 0: new [client-session] srv78supervision: Requesting channel_open for channel 0. srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 srv78supervision: Got channel open confirmation, requesting shell. srv78supervision: Requesting service shell on channel 0. srv78supervision: channel 1: new [client-session] srv78supervision: Requesting channel_open for channel 1. srv78supervision: Entering interactive session. Received disconnect message: Device does not support shell request not=20 preceded by pty request. at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284 Do you think that this bug come from HP Procurve 2650 ? It's not my first problem with this material (storm broadcasting for=20 exemple), i believe that this IOS is a piece of chit !!! No more idea ? Must i give up ? Heinrich, Matthew a =E9crit : > =20 > > Looks like some of the formatting got messed up in transit... =20 > > > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On Behalf Of > Heinrich, Matthew > Sent: Monday, November 27, 2006 4:52 PM > To: DonKiShoot; ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Device does not support shell > requestnotpreceded by pty request > > I have been working on the same sort of problem for a while now. I was > getting this same error because the "cmd" function of Net::SSH::Perl > will always expect an exit code, and the devices to which we are > communicating do not support exit codes after each command. Also, the > device prefers to have all commands sent through the same channel, and > Net::SSH::Perl will open a new channel for each command when using > SSHv2. > > At first, I tried copying "sub cmd" to "sub ccmd" and making it use the > same channel, but I could not get the buffers to work properly. A lot > of people said to use an Expect script, but that didn't seem like good > idea, until I took a look at the Expect Perl module... > > I created a connecting script (connect.pl) which will login and get me > to an interactive prompt: > > -----------------------------------------------------------------------= - > -------- > #!/usr/bin/perl > > use strict; > use Net::SSH::Perl; > > my $host =3D "a.b.c.d"; > my $user =3D "uname"; > my $pass =3D "pword"; > > my $ssh =3D Net::SSH::Perl->new($host, port=3D>22); $ssh->login($user, > $pass); $ssh->shell(); > -----------------------------------------------------------------------= - > -------- > > > Next, I created the main Perl script using the Expect module, spawning > this connection program: > > > -----------------------------------------------------------------------= - > -------- > #!/usr/bin/perl > > use Expect; > > $| =3D 1; # Auto flush output > > my $exp =3D Expect->new(); > > # Prevent local echo from showing in results=20 > $exp->raw_pty(1); > > # Run connector program > $exp->spawn("./connect.pl"); > > # Prevent output from going to STDOUT > (*$exp)->{exp_Log_Stdout} =3D 0; > > # Wait for initial prompt (30 sec timeout)=20 > $exp->expect(30, "centerpoint>"); > > # Send command with no output needed > snd("set rows 0"); > > print "Sending remote command..."; > > # Send command, store output in @res array=20 > @res =3D snd("show vss"); > > print "OK\n\nResults:\n"; > > # List output line-by-line > foreach $n (0..$#res) { > print "$n: @res[$n]\n"; > } > > $exp->send("exit\n"); > $exp->soft_close(); > > # This makes sending multiple commands much easier. Instead of=20 > # using multiple "send" and "expect" calls manually, just use snd=20 > > sub snd ($){ > $exp->send(@_[0] . "\n"); > > # Use the "-re" option to specify regular expression, as > # opposed to an exact pattern match. Otherwise, you can=20 > # just list 2 arguments (timeout, pattern match) > my @out =3D $exp->expect(10, "-re", 'centerpoint>$'); > my @newout =3D split(/\n/, @out[3]); > > # Remove first line (in my case, it shows the command I typed, > # which is not needed in the resulting output) > shift @newout; > > return wantarray ? @newout : 1; > } > -----------------------------------------------------------------------= - > -------- > > > This script will wait for connect.pl to present the CLI prompt (in this > case, it shows "centerpoint>"), and will be able to interact with the > SSH session more easily than if you modified Net::SSH::Perl, or if you > used TCL Expect. > > > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On Behalf Of > DonKiShoot > Sent: Wednesday, November 22, 2006 8:16 AM > To: ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Device does not support shell reques= t > notpreceded by pty request > > Hello all, > > I'm trying to send some commands to my switch HP Procurve 2650 in ssh2 > with Net::SSH::Perl with user 'operator' and pubkey authentification. > It appears that i have a problem when starting to send command but > authentification seems good. > > This is sample of my perl script and next debug trace with error i > receive: > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > foreach my $addr (keys %Switch) { > # print "$addr, $Switch{$addr}{'login'} :\n"; > my $ssh =3D Net::SSH::Perl->new($addr,'debug' =3D> 1, 'use_pty' =3D>= 1, > 'protocol' =3D> 2, 'interactive' =3D> 0, options =3D> ["RhostsAuthentic= ation > no"]); > > #$ssh->register_handler("stdout", sub { > # my($channel, $buffer) =3D @_; > # print "I received this: ", $buffer->bytes; > # }); > > $ssh->login($Switch{$addr}{'login'}); > > my($stdout, $stderr, $exit) =3D $ssh->cmd("\n"); > print "$stdout $stderr $exit\n"; > ($stdout, $stderr, $exit) =3D $ssh->cmd("ping $ip"); > print "$stdout $stderr $exit\n"; > } > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > srv78supervision: Reading configuration data /root/.ssh/config > srv78supervision: Reading configuration data /etc/ssh_config > srv78supervision: Allocated local port 1023. > srv78supervision: Connecting to 10.1.2.22, port 22. > srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 > > srv78supervision: Remote protocol version 2.0, remote software version > OpenSSH_3.7.1p2 > srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. > srv78supervision: No compat match: OpenSSH_3.7.1p2. > srv78supervision: Connection established. > srv78supervision: Sent key-exchange init (KEXINIT), wait response. > srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none > srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none > srv78supervision: Entering Diffie-Hellman Group 1 key exchange. > srv78supervision: Sent DH public key, waiting for reply. > srv78supervision: Received host key, type 'ssh-rsa'. > srv78supervision: Host '10.1.2.22' is known and matches the host key. > srv78supervision: Computing shared secret key. > srv78supervision: Verifying server signature. > srv78supervision: Waiting for NEWKEYS message. > srv78supervision: Enabling incoming encryption/MAC/compression. > srv78supervision: Send NEWKEYS, enable outgoing > encryption/MAC/compression. > srv78supervision: Sending request for user-authentication service. > srv78supervision: Service accepted: ssh-userauth. > srv78supervision: Trying empty user-authentication request. > srv78supervision: Authentication methods that can continue:=20 > publickey,password. > srv78supervision: Next method to try is publickey. > srv78supervision: Trying pubkey authentication with key file > '/root/.ssh/id_dsa' > srv78supervision: Login completed, opening dummy shell channel. > srv78supervision: channel 0: new [client-session] > srv78supervision: Requesting channel_open for channel 0. > srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 > srv78supervision: Got channel open confirmation, requesting shell. > srv78supervision: Requesting service shell on channel 0. > srv78supervision: channel 1: new [client-session] > srv78supervision: Requesting channel_open for channel 1. > srv78supervision: Entering interactive session. > /*Received disconnect message: Device does not support shell request no= t > preceded by pty request. > at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284*/ > > What can i do to resolve this problem ? > > Thx all > > > > > -----------------------------------------------------------------------= - > - > Take Surveys. Earn Cash. Influence the Future of IT Join > SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE > V > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > -----------------------------------------------------------------------= - > - > Take Surveys. Earn Cash. Influence the Future of IT Join > SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE > V > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > > =20 |
From: Heinrich, M. <Mat...@sa...> - 2006-11-27 22:59:15
|
=20 Looks like some of the formatting got messed up in transit... =20 -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Heinrich, Matthew Sent: Monday, November 27, 2006 4:52 PM To: DonKiShoot; ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Device does not support shell requestnotpreceded by pty request I have been working on the same sort of problem for a while now. I was getting this same error because the "cmd" function of Net::SSH::Perl will always expect an exit code, and the devices to which we are communicating do not support exit codes after each command. Also, the device prefers to have all commands sent through the same channel, and Net::SSH::Perl will open a new channel for each command when using SSHv2. At first, I tried copying "sub cmd" to "sub ccmd" and making it use the same channel, but I could not get the buffers to work properly. A lot of people said to use an Expect script, but that didn't seem like good idea, until I took a look at the Expect Perl module... I created a connecting script (connect.pl) which will login and get me to an interactive prompt: ------------------------------------------------------------------------ -------- #!/usr/bin/perl use strict; use Net::SSH::Perl; my $host =3D "a.b.c.d"; my $user =3D "uname"; my $pass =3D "pword"; my $ssh =3D Net::SSH::Perl->new($host, port=3D>22); $ssh->login($user, $pass); $ssh->shell(); ------------------------------------------------------------------------ -------- Next, I created the main Perl script using the Expect module, spawning this connection program: ------------------------------------------------------------------------ -------- #!/usr/bin/perl use Expect; $| =3D 1; # Auto flush output my $exp =3D Expect->new(); # Prevent local echo from showing in results=20 $exp->raw_pty(1); # Run connector program $exp->spawn("./connect.pl"); # Prevent output from going to STDOUT (*$exp)->{exp_Log_Stdout} =3D 0; # Wait for initial prompt (30 sec timeout)=20 $exp->expect(30, "centerpoint>"); # Send command with no output needed snd("set rows 0"); print "Sending remote command..."; # Send command, store output in @res array=20 @res =3D snd("show vss"); print "OK\n\nResults:\n"; # List output line-by-line foreach $n (0..$#res) { print "$n: @res[$n]\n"; } $exp->send("exit\n"); $exp->soft_close(); # This makes sending multiple commands much easier. Instead of=20 # using multiple "send" and "expect" calls manually, just use snd=20 sub snd ($){ $exp->send(@_[0] . "\n"); # Use the "-re" option to specify regular expression, as # opposed to an exact pattern match. Otherwise, you can=20 # just list 2 arguments (timeout, pattern match) my @out =3D $exp->expect(10, "-re", 'centerpoint>$'); my @newout =3D split(/\n/, @out[3]); # Remove first line (in my case, it shows the command I typed, # which is not needed in the resulting output) shift @newout; return wantarray ? @newout : 1; } ------------------------------------------------------------------------ -------- This script will wait for connect.pl to present the CLI prompt (in this case, it shows "centerpoint>"), and will be able to interact with the SSH session more easily than if you modified Net::SSH::Perl, or if you used TCL Expect. -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of DonKiShoot Sent: Wednesday, November 22, 2006 8:16 AM To: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Device does not support shell request notpreceded by pty request Hello all, I'm trying to send some commands to my switch HP Procurve 2650 in ssh2 with Net::SSH::Perl with user 'operator' and pubkey authentification. It appears that i have a problem when starting to send command but authentification seems good. This is sample of my perl script and next debug trace with error i receive: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ foreach my $addr (keys %Switch) { # print "$addr, $Switch{$addr}{'login'} :\n"; my $ssh =3D Net::SSH::Perl->new($addr,'debug' =3D> 1, 'use_pty' =3D> = 1, 'protocol' =3D> 2, 'interactive' =3D> 0, options =3D> = ["RhostsAuthentication no"]); #$ssh->register_handler("stdout", sub { # my($channel, $buffer) =3D @_; # print "I received this: ", $buffer->bytes; # }); $ssh->login($Switch{$addr}{'login'}); my($stdout, $stderr, $exit) =3D $ssh->cmd("\n"); print "$stdout $stderr $exit\n"; ($stdout, $stderr, $exit) =3D $ssh->cmd("ping $ip"); print "$stdout $stderr $exit\n"; } +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ srv78supervision: Reading configuration data /root/.ssh/config srv78supervision: Reading configuration data /etc/ssh_config srv78supervision: Allocated local port 1023. srv78supervision: Connecting to 10.1.2.22, port 22. srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 srv78supervision: Remote protocol version 2.0, remote software version OpenSSH_3.7.1p2 srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. srv78supervision: No compat match: OpenSSH_3.7.1p2. srv78supervision: Connection established. srv78supervision: Sent key-exchange init (KEXINIT), wait response. srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none srv78supervision: Entering Diffie-Hellman Group 1 key exchange. srv78supervision: Sent DH public key, waiting for reply. srv78supervision: Received host key, type 'ssh-rsa'. srv78supervision: Host '10.1.2.22' is known and matches the host key. srv78supervision: Computing shared secret key. srv78supervision: Verifying server signature. srv78supervision: Waiting for NEWKEYS message. srv78supervision: Enabling incoming encryption/MAC/compression. srv78supervision: Send NEWKEYS, enable outgoing encryption/MAC/compression. srv78supervision: Sending request for user-authentication service. srv78supervision: Service accepted: ssh-userauth. srv78supervision: Trying empty user-authentication request. srv78supervision: Authentication methods that can continue:=20 publickey,password. srv78supervision: Next method to try is publickey. srv78supervision: Trying pubkey authentication with key file '/root/.ssh/id_dsa' srv78supervision: Login completed, opening dummy shell channel. srv78supervision: channel 0: new [client-session] srv78supervision: Requesting channel_open for channel 0. srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 srv78supervision: Got channel open confirmation, requesting shell. srv78supervision: Requesting service shell on channel 0. srv78supervision: channel 1: new [client-session] srv78supervision: Requesting channel_open for channel 1. srv78supervision: Entering interactive session. /*Received disconnect message: Device does not support shell request not preceded by pty request. at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284*/ What can i do to resolve this problem ? Thx all ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Heinrich, M. <Mat...@sa...> - 2006-11-27 22:52:21
|
I have been working on the same sort of problem for a while now. I was getting this same error because the "cmd" function of Net::SSH::Perl will always expect an exit code, and the devices to which we are communicating do not support exit codes after each command. Also, the device prefers to have all commands sent through the same channel, and Net::SSH::Perl will open a new channel for each command when using SSHv2. At first, I tried copying "sub cmd" to "sub ccmd" and making it use the same channel, but I could not get the buffers to work properly. A lot of people said to use an Expect script, but that didn't seem like good idea, until I took a look at the Expect Perl module... I created a connecting script (connect.pl) which will login and get me to an interactive prompt: ------------------------------------------------------------------------ -------- #!/usr/bin/perl use strict; use Net::SSH::Perl; my $host =3D "a.b.c.d"; my $user =3D "uname"; my $pass =3D "pword"; my $ssh =3D Net::SSH::Perl->new($host, port=3D>22); $ssh->login($user, $pass); $ssh->shell(); ------------------------------------------------------------------------ -------- Next, I created the main Perl script using the Expect module, spawning this connection program: ------------------------------------------------------------------------ -------- #!/usr/bin/perl use Expect; $| =3D 1; # Auto flush output my $exp =3D Expect->new(); # Prevent local echo from showing in results $exp->raw_pty(1); # Run connector program $exp->spawn("./connect.pl"); # Prevent output from going to STDOUT (*$exp)->{exp_Log_Stdout} =3D 0; # Wait for initial prompt (30 sec timeout) $exp->expect(30, "centerpoint>"); # Send command with no output needed snd("set rows 0"); print "Sending remote command..."; # Send command, store output in @res array @res =3D snd("show vss"); print "OK\n\nResults:\n"; # List output line-by-line foreach $n (0..$#res) { print "$n: @res[$n]\n"; } $exp->send("exit\n"); $exp->soft_close(); # This makes sending multiple commands much easier. Instead of # using multiple "send" and "expect" calls manually, just use snd sub snd ($){ $exp->send(@_[0] . "\n"); # Use the "-re" option to specify regular expression, as # opposed to an exact pattern match. Otherwise, you can=20 # just list 2 arguments (timeout, pattern match) my @out =3D $exp->expect(10, "-re", 'centerpoint>$'); my @newout =3D split(/\n/, @out[3]); # Remove first line (in my case, it shows the command I typed, # which is not needed in the resulting output) shift @newout; return wantarray ? @newout : 1; } ------------------------------------------------------------------------ -------- This script will wait for connect.pl to present the CLI prompt (in this case, it shows "centerpoint>"), and will be able to interact with the SSH session more easily than if you modified Net::SSH::Perl, or if you used TCL Expect. -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of DonKiShoot Sent: Wednesday, November 22, 2006 8:16 AM To: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Device does not support shell request notpreceded by pty request Hello all, I'm trying to send some commands to my switch HP Procurve 2650 in ssh2 with Net::SSH::Perl with user 'operator' and pubkey authentification. It appears that i have a problem when starting to send command but authentification seems good. This is sample of my perl script and next debug trace with error i receive: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ foreach my $addr (keys %Switch) { # print "$addr, $Switch{$addr}{'login'} :\n"; my $ssh =3D Net::SSH::Perl->new($addr,'debug' =3D> 1, 'use_pty' =3D> = 1, 'protocol' =3D> 2, 'interactive' =3D> 0, options =3D> = ["RhostsAuthentication no"]); #$ssh->register_handler("stdout", sub { # my($channel, $buffer) =3D @_; # print "I received this: ", $buffer->bytes; # }); $ssh->login($Switch{$addr}{'login'}); my($stdout, $stderr, $exit) =3D $ssh->cmd("\n"); print "$stdout $stderr $exit\n"; ($stdout, $stderr, $exit) =3D $ssh->cmd("ping $ip"); print "$stdout $stderr $exit\n"; } +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ srv78supervision: Reading configuration data /root/.ssh/config srv78supervision: Reading configuration data /etc/ssh_config srv78supervision: Allocated local port 1023. srv78supervision: Connecting to 10.1.2.22, port 22. srv78supervision: Remote version string: SSH-2.0-OpenSSH_3.7.1p2 srv78supervision: Remote protocol version 2.0, remote software version OpenSSH_3.7.1p2 srv78supervision: Net::SSH::Perl Version 1.30, protocol version 2.0. srv78supervision: No compat match: OpenSSH_3.7.1p2. srv78supervision: Connection established. srv78supervision: Sent key-exchange init (KEXINIT), wait response. srv78supervision: Algorithms, c->s: 3des-cbc hmac-sha1 none srv78supervision: Algorithms, s->c: 3des-cbc hmac-sha1 none srv78supervision: Entering Diffie-Hellman Group 1 key exchange. srv78supervision: Sent DH public key, waiting for reply. srv78supervision: Received host key, type 'ssh-rsa'. srv78supervision: Host '10.1.2.22' is known and matches the host key. srv78supervision: Computing shared secret key. srv78supervision: Verifying server signature. srv78supervision: Waiting for NEWKEYS message. srv78supervision: Enabling incoming encryption/MAC/compression. srv78supervision: Send NEWKEYS, enable outgoing encryption/MAC/compression. srv78supervision: Sending request for user-authentication service. srv78supervision: Service accepted: ssh-userauth. srv78supervision: Trying empty user-authentication request. srv78supervision: Authentication methods that can continue:=20 publickey,password. srv78supervision: Next method to try is publickey. srv78supervision: Trying pubkey authentication with key file '/root/.ssh/id_dsa' srv78supervision: Login completed, opening dummy shell channel. srv78supervision: channel 0: new [client-session] srv78supervision: Requesting channel_open for channel 0. srv78supervision: channel 0: open confirm rwindow 0 rmax 32768 srv78supervision: Got channel open confirmation, requesting shell. srv78supervision: Requesting service shell on channel 0. srv78supervision: channel 1: new [client-session] srv78supervision: Requesting channel_open for channel 1. srv78supervision: Entering interactive session. /*Received disconnect message: Device does not support shell request not preceded by pty request. at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284*/ What can i do to resolve this problem ? Thx all ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: <eri...@wa...> - 2006-11-22 22:24:51
|
I will be out of the office starting 11/20/2006 and will not return until 11/24/2006. |