# Problem with Net::SFTP

**URL:** <https://www.ruby-forum.com/t/problem-with-net-sftp/173983>\
**Category:** Ruby\
**Created:** [August 19, 2009, 3:18am UTC](https://www.ruby-forum.com/t/problem-with-net-sftp/173983 "2009-08-19T03:18:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robintw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@robintw](https://www.ruby-forum.com/u/robintw)\
**Post date:** [August 19, 2009, 3:18am UTC](https://www.ruby-forum.com/t/problem-with-net-sftp/173983/1 "2009-08-19T03:18:29Z")

</div>

I apologize if this is not the right place to post a message about a gem  
like Net::SFTP - if there is a more appropriate forum please let me  
know.

When I try to connect to one SFTP server, everything works great. This  
is the code:

require “net/sftp”

class TestSftp  
Net::SFTP.start("", “”,  
:password =\> “”)  
do |sftp|  
sftp.download!("",  
“”)  
end  
end

However when trying to connect to a particular SFTP server, I receive  
the following error message:

/var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/operations/download.rb:307:in  
`on_open': open 0014059_PRICE.CSV: failure (4) (RuntimeError) from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in`to\_proc’  
from  
/var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/request.rb:87:in  
`call' from /var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/request.rb:87:in`respond\_to’  
from  
/var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/session.rb:947:in  
`dispatch_request' from /var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/session.rb:910:in`when\_channel\_polled’  
from /usr/lib/ruby/1.8/rubygems/custom\_require.rb:27:in  
`to_proc' from /var/lib/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/channel.rb:311:in`call’  
from  
/var/lib/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/channel.rb:311:in  
`process' ... 26 levels... from /var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/session.rb:801:in`loop’  
from  
/var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp/session.rb:786:in  
`connect!' from /var/lib/gems/1.8/gems/net-sftp-2.0.2/lib/net/sftp.rb:32:in`start’  
from testSftp.rb:12

Line 307 in download.rb looks like this:

raise “open #{entry.remote}: #{response}” unless response.ok?

However, I really don’t know what’s going on. One thing to note is that  
I can sftp fine from the command line to this particular server - I’m  
pretty sure it’s not an issue with my login credentials being correct.  
I’m wondering if a different protocol is being used and Net::SFTP is  
having problems with that. Does anyone have any experience with this?  
Thanks.

---

<div class="post-metadata">

**Author:** ![robintw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@robintw](https://www.ruby-forum.com/u/robintw)\
**Post date:** [August 19, 2009, 3:27am UTC](https://www.ruby-forum.com/t/problem-with-net-sftp/173983/2 "2009-08-19T03:27:39Z")

</div>

I did not mean to post this multiple times - I thought I was seeing a  
“Preview” screen and backed up to make minor edits and unwittingly  
re-submitted.

I am very sorry for the extra posts/noise.
