Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id:
115187
Status:
rejected
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
varada.puspak [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Issue with Net::SSH2::Channel
Date: Thu, 9 Jun 2016 18:00:34 +0530
To: bug-Net-SSH2@rt.cpan.org
From: n v prakash reddy <varada.puspak@gmail.com>
Hi There,

I am perl developer.

Experiencing issues with SSH channel created using Net::SSH2::Channel.

Issue: Not able to execute commands in child process using SSH Channel object created in parent process.
What could the reason for failure?.
Is there any quick resolution?.
Am i doing wrong?.



--
Regards
N V PRAKASH REDDY
Net::SSH2 objects can not be shared between different processes. Use a per-process object.
Subject: RE: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
Date: Thu, 9 Jun 2016 20:23:10 +0530
To: <bug-Net-SSH2@rt.cpan.org>
From: N V Prakash Reddy <varada.puspak@gmail.com>
Are there any other SSH modules can share SSH objects between processes?.


From: Salvador Fandino Garcia via RT
Sent: ‎09-‎06-‎2016 18:28
To: varada.puspak@gmail.com
Subject: [rt.cpan.org #115187] Issue with Net::SSH2::Channel

<URL: https://rt.cpan.org/Ticket/Display.html?id=115187 >

Net::SSH2 objects can not be shared between different processes.

Use a per-process object.
Subject: Re: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
Date: Thu, 9 Jun 2016 15:37:20 +0000 (UTC)
To: "bug-Net-SSH2@rt.cpan.org" <bug-Net-SSH2@rt.cpan.org>
From: Salvador Fandino <sfandino@yahoo.com>
Show quoted text
----- Original Message -----
> From: n v prakash reddy via RT <bug-Net-SSH2@rt.cpan.org> > To: > Sent: Thursday, June 9, 2016 4:53 PM > Subject: RE: [rt.cpan.org #115187] Issue with Net::SSH2::Channel > > Queue: Net-SSH2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=115187 > > > Are there any other SSH modules can share SSH objects between processes?.
If you are on Linux/Unix, you can use Net::OpenSSH.
Subject: Re: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
Date: Sat, 11 Jun 2016 08:26:17 +0530
To: bug-Net-SSH2@rt.cpan.org
From: n v prakash reddy <varada.puspak@gmail.com>
Thank you very much for the support.
Have few questions:

How many channel objects can be created per one Net::SSH2 object (connection)?.
How many shell's we can invoke per one Net::SSH2::Channel object (connection)?.
What shell method in Net::SSH2::Channel is doing?
Which object out of Net::SSH2 object, Net::SSH2::Channel object is a actual SSH connection?.
Is every channel object is SSH connection to a remote host?.

My Requirement:
  i want to create one SSH connection to a remote machine, and create 100 channels or 1 channel with 100 shells over one SSH connection created earlier.
Is there a SSH module which will fulfill my requirement?.




On Thu, Jun 9, 2016 at 9:07 PM, Salvador \"Fandiño\" via RT <bug-Net-SSH2@rt.cpan.org> wrote:
Show quoted text
<URL: https://rt.cpan.org/Ticket/Display.html?id=115187 >





----- Original Message -----
> From: n v prakash reddy via RT <bug-Net-SSH2@rt.cpan.org>
> To:
> Sent: Thursday, June 9, 2016 4:53 PM
> Subject: RE: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
>
>        Queue: Net-SSH2
> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=115187 >
>
> Are there any other SSH modules can share SSH objects between processes?.


If you are on Linux/Unix, you can use Net::OpenSSH.




--
Regards
N V PRAKASH REDDY
Subject: Re: [rt.cpan.org #115187] Issue with Net::SSH2::Channel
Date: Sat, 11 Jun 2016 07:08:07 +0000 (UTC)
To: "bug-Net-SSH2@rt.cpan.org" <bug-Net-SSH2@rt.cpan.org>
From: Salvador Fandino <sfandino@yahoo.com>
Show quoted text
----- Original Message -----
> From: n v prakash reddy via RT <bug-Net-SSH2@rt.cpan.org> > To: > Sent: Saturday, June 11, 2016 4:56 AM > Subject: Re: [rt.cpan.org #115187] Issue with Net::SSH2::Channel > > Queue: Net-SSH2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=115187 > > > Thank you very much for the support. > Have few questions:
RT is not a place for asking questions. PerlMonks or StackOverflow are better places for that. I visit then regularly and will answer your questions there.
> How many channel objects can be created per one Net::SSH2 object
> (connection)?.
Usually, SSH servers limit the number of *concurrent* channels running over a single connection to around 10. But then, as far as you don't reach this limit, you can open and close as many channels as you want over the lifetime of the connection.
> How many shell's we can invoke per one Net::SSH2::Channel object
> (connection)?.
One: once you have invoked one of exec, shell or subsystem in a channel, you can not do it again.
> What shell method in Net::SSH2::Channel is doing?
It starts a remote shell that keeps waiting for commands over its stdin channel which is plugged to the remote side of the channel. Tipically, on a channel where you have called "shell", you write commands as... $ssh->write("$cmd\n") and then read the output until you get back a prompt and then, your write another command, etc. Anyway this is not a recommended way to use SSH. When possible it is better to use the "exec" method which just runs a single command over a channel. Using is easier to write reliable programs using "exec" than "shell", as talking to the shell can become quite tricky.
> Which object out of Net::SSH2 object, Net::SSH2::Channel object is a actual
> SSH connection?.
Net::SSH2 maintains a TCP connection to the remote hosts and runs the SSH protocol over it. All the channel objects hanging from a Net::SSH2 object are multiplexed over that single TCP connection.
> Is every channel object is SSH connection to a remote host?.
No
> My Requirement: > i want to create one SSH connection to a remote machine, and create 100 > channels or 1 channel with 100 shells over one SSH connection created
> earlier.
That's not a very common approach, and as I told you before, the server may limit the number of channels open over a single connection to around 10. Anyway, probably there is a better way to do what you need without opening 100 concurrent channels.
> Is there a SSH module which will fulfill my requirement?.
Net::SSH2, Net::OpenSSH, Net::SSH::Any and Net::SSH::Perl can do that.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.