Thread: Re: [Ssh-sftp-perl-users] Device does not support shell request not preceded by pty request
Brought to you by:
dbrobins
From: DonKiShoot <don...@wa...> - 2006-11-22 14:17:04
|
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 = Net::SSH::Perl->new($addr,'debug' => 1, 'use_pty' => 1, 'protocol' => 2, 'interactive' => 0, options => ["RhostsAuthentication no"]); #$ssh->register_handler("stdout", sub { # my($channel, $buffer) = @_; # print "I received this: ", $buffer->bytes; # }); $ssh->login($Switch{$addr}{'login'}); my($stdout, $stderr, $exit) = $ssh->cmd("\n"); print "$stdout $stderr $exit\n"; ($stdout, $stderr, $exit) = $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: 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 |
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: 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: 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-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-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 |