From: greg Date: 2006-11-09T04:56:51+09:00 Subject: Re: Net::SSH Data Stream Problem I had the same problem where my ssh connection closing early. I solved it by opening a shell- don't know if that can help with sftp though. I am having no problems copying files with the ftp library. Net::SSH.start(SSH_SERVER, :username => u, :password => p) do |session| shell = session.shell.sync shell.exec( cmd ).stdout end