Re: [Ssh-sftp-perl-users] Multiple operations in a single channel/shell? (Net::SSH)
Brought to you by:
dbrobins
|
From: Mihai S. <mih...@de...> - 2004-12-13 11:33:57
|
On Monday 13 December 2004 13:00, Wildish, Joe wrote:
> I understood from the documentation that SSH 1 would create a new
> connection each time, rather than channel (?). However, it could well be
> me mis-reading it (I'm no SSH expert).
Sorry,... was my mistake I missunderstood you, I thought your problem was it
creates multiple connections.
>
> Anyway, you got me thinking; I was not specifying the protocol version
> to use in the constructor. So, I tried specifiying "2", but the debug
> output still indicates there are multiple channels in use. I then
> remembered I didn't even compile in SSH1 support when I made the module,
> so it must have been using 2 all along.
>
> Incidently, I was getting this in the debug output:
>
> <hostname>: Remote protocol version 2.0, remote software version 3.0.1
> F-SECURE SSH
> <hostname>: Net::SSH::Perl Version 1.25, protocol version 2.0.
> <hostname>: No compat match: 3.0.1 F-SECURE SSH
>
> I had a quick look through the code and it would seem F-Secure isn't
> checked for. So I put an entry in to match it, with a mask of zero, but
> the results were the same.
>
> Any other ideas?
>
> Thanks,
> Joe
>
> -----Original Message-----
> From: ssh...@li...
> [mailto:ssh...@li...] On Behalf Of
> Mihai Secasiu
> Sent: 12 December 2004 18:17
> To: ssh...@li...
> Subject: Re: [Ssh-sftp-perl-users] Multiple operations in a single
> channel/shell? (Net::SSH)
>
>
> you can execute multiple commands on the same channel if you use SSH 2
>
> On Friday 10 December 2004 13:03, Wildish, Joe wrote:
> > I originally thought that I could use Net::SSH::Perl to issue multiple
> >
> > commands in the same shell. However, having looked into it a little
> > more, it seems that this is not the default behaviour. I have done a
> > little research, and it appears that a seperate channel is created
> > each time the cmd method is called - which effectively creates a new
> > shell.
> >
> > I am wanting to execute the commands in the same shell. For example:
> >
> > ($out,$err,$rc) = $ssh->cmd("export FOO=WIBBLE");
> > ($out2,$err2,$rc2) = $ssh->cmd("print $FOO");
> >
> > $out2 would equal "WIBBLE"....
> >
> > I think I can probably achieve this behaviour by registering a handler
> >
> > and iterating through each of the commands I want to issue within the
> > subroutine, but this doesn't seem the nicest way. Ideally, if I could
> > pass in the channel number to the cmd method, that would be cool... I
> > am assuming of course that there are no problems with this approach?
> >
> > I was hoping people on this list may have come across this requirement
> >
> > before, and could perhaps point me in the right direction .... (?)
> >
> > Regards,
> > Joe
--
+-----------------------------------------------------------------------
| Mihai Secasiu
| http://denixsolutions.com/
| Complete Unix/Linux Solutions for your Business
+-----------------------------------------------------------------------
|