Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1111217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:30:46+00:00 2026-05-17T02:30:46+00:00

Trying to use Net::SFTP, version 2.05 (appears to be the latest). But it fails

  • 0

Trying to use Net::SFTP, version 2.05 (appears to be the latest). But it fails even on its own sample code (below, from http://net-ssh.rubyforge.org/sftp/v2/api/index.html). The domain, user and password are the same as I use to log in manually. I will change the paths when I can get that far.

Net::SFTP.start('ftp.domain.com', 'user', :password => 'password') do |sftp|

    # upload a file or directory to the remote host
    sftp.upload!("/path/to/local", "/path/to/remote")

    # download a file or directory from the remote host
    sftp.download!("/path/to/remote", "/path/to/local")

    # grab data off the remote host directly to a buffer
    data = sftp.download!("/path/to/remote")

    # open and write to a pseudo-IO for a remote file
    sftp.file.open("/path/to/remote", "w") do |f|
      f.puts "Hello, world!\n"
    end

    # open and read from a pseudo-IO for a remote file
    sftp.file.open("/path/to/remote", "r") do |f|
      puts f.gets
    end

    # create a directory
    sftp.mkdir! "/path/to/directory"

    # list the entries in a directory
    sftp.dir.foreach("/html") do |entry|
      puts entry.longname
    end
  end

It hangs on the first line, and the traceback is below (line 14 is the Net::SFTP.start line)…

    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-sftp-2.0.5/lib/net/sftp/session.rb:801:in `block in loop'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh/connection/session.rb:212:in `preprocess'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh/connection/session.rb:197:in `process'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh/connection/session.rb:161:in `block in loop'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh/connection/session.rb:161:in `loop'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.0.23/lib/net/ssh/connection/session.rb:161:in `loop'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-sftp-2.0.5/lib/net/sftp/session.rb:802:in `loop'
    c:/ruby192/lib/ruby/gems/1.9.1/gems/net-sftp-2.0.5/lib/net/sftp.rb:35:in `start'
    C:/Data/dev/Ruby/RubyProjects/FTP_test/lib/ftp_test.rb:14:in `<top (required)>'

Windows 7, netbeans 6.9.1, ruby 1.9.2. The sample code is from the readme at..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:30:47+00:00Added an answer on May 17, 2026 at 2:30 am

    When i used Net::SFTP in Perl i faced similar issue and its becos ssh path was not set properly.
    Can you check whether SSH is in path.
    I know the answer is not related to Ruby but suggested this as a general observation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use TestDriven.Net not only to test my code, but to call
I am trying to use the .net configuration tool in windows 7 but can
I'm trying to use the asp.net (3.5) built in user management framework but I'm
I am trying to use ADO.Net Codefirst feature of latest Entity Framework 4.0. As
i am trying to use urlrewriter.net and i followed instructions here but when i
I am trying to use a .NET DLL from Java code ( Through a
I have been trying to use protobuf-net with MonoTouch but I have no idea
I'm trying to use JsonPath for .NET ( http://code.google.com/p/jsonpath/downloads/list ) and I'm having trouble
I'm trying to use Net::SSH::Perl to connect using public keys with this code: my
I'm trying to use .NET HttpListener in a C# project. When I register my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.