# Net::SSH fails on second retry over remote tunnel

**URL:** <https://www.ruby-forum.com/t/net-ssh-fails-on-second-retry-over-remote-tunnel/113508>\
**Category:** Ruby\
**Created:** [August 31, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/net-ssh-fails-on-second-retry-over-remote-tunnel/113508 "2007-08-31T23:32:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Madden\_MD](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@Brian\_Madden\_MD](https://www.ruby-forum.com/u/Brian_Madden_MD)\
**Post date:** [August 31, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/net-ssh-fails-on-second-retry-over-remote-tunnel/113508/1 "2007-08-31T23:32:41Z")

</div>

Hello-

Please pardon me if I’m naïve, this is my first post.

I’m working on enabling DRbSSL to tunnel through an SSH connection.

My setup is that the “client” runs a DRbSSL service, which starts, and  
then  
NetSSH is used to perform a client login to the remote host server, and  
then  
sets up a remote\_to port forward, so that when the host server wants to  
contact the client, it can send a “drbssl://localhost:remote\_port”  
command  
to itself which should forward through the tunnel to the client drbssl  
service.

To clarify:  
On the client computer: drbssl://0.0.0.0:12321 (local blocked port that  
it  
is listening on)  
This is tunnelled to the host server with a forwarded remote port of  
16000,  
by logging into SSH and setting the forward.  
On the remote computer: drbssl://localhost:16000 responds with the  
client’s  
DRB service.

Here’s my problem:

The client DRB installs and sets up just fine. No problem.  
When I make the FIRST call, from the host server,  
drbssl://localhost:16000,  
it works.  
When I make a SECOND call, to the same address, it hangs and then dies  
with  
the error that “a request to send or receive data was disallowed because  
the  
socket had already been shutdown in that direction with a previous  
shutdown  
call.”

## First, I’m using OpenSSH for Windows (windows server 2003, sorry), but I also confirmed this on CopSSH using a second server (also Windows, w2k)

same error. My Net::SSH and OpenSSH are up to date.

I’ve tried several methods of fixing this, from reconfiguring my  
sshd\_config  
file, to trying different methods of the Net:SSH session loop, with no  
luck.  
It does not seem to matter how I connect to localhost:16000.

The issues I think might be relevant:

- why does Net::SSH close the socket after forwarding data? Is this a  
Windows problem?
- Or is my problem that Drb is sending some kind of stop signal that  
Net::SSH is interpreting as a closed session?
- Or should I avoid Net::SSH and use Putty or some other SSH client to  
create the tunnel?

I can post my scripts and/or sshd\_config on request, not sure if that is  
going to be useful. I might also ask for help in how to ssh debug, as  
I’m  
sure that might be revealing but I haven’t figured out how to read the  
active ssh log file (!).

Thanks-  
Brian Madden

---

<div class="post-metadata">

**Author:** ![Brian\_Madden\_MD](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@Brian\_Madden\_MD](https://www.ruby-forum.com/u/Brian_Madden_MD)\
**Post date:** [September 1, 2007, 6:03am UTC](https://www.ruby-forum.com/t/net-ssh-fails-on-second-retry-over-remote-tunnel/113508/2 "2007-09-01T06:03:08Z")

</div>

On 9/1/07, Brian Madden MD [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> to itself which should forward through the tunnel to the client drbssl
> 
> First, I’m using OpenSSH for Windows (windows server 2003, sorry), but I
> 
> - Or is my problem that Drb is sending some kind of stop signal that  
> Net::SSH is interpreting as a closed session?
> - Or should I avoid Net::SSH and use Putty or some other SSH client to  
> create the tunnel?
> 
> I can post my scripts and/or sshd\_config on request, not sure if that is  
> going to be useful. I might also ask for help in how to ssh debug, as I’m  
> sure that might be revealing but I haven’t figured out how to read the  
> active ssh log file (!).

Catch Jamis buck on Capistrano mailing list or his blog. He rarely  
pops in here i suppose.

–  
Let them talk of their oriental summer climes of everlasting  
conservatories; give me the privilege of making my own summer with my  
own coals.

[http://blog.gnufied.org](http://blog.gnufied.org)
