net/sftp problem

Discussion in 'Ruby' started by Damjan Rems, Sep 23, 2008.

  1. Damjan Rems

    Damjan Rems Guest

    I am trying to transfer a file to remote server with net::sftp.

    require 'rubygems'
    require 'net/sftp'

    Net::SFTP.start('192.168.1.111', 'rems', :password => 'mypwd') do
    |sftp|
    sftp.upload!('testSFTP.rb', '/home/rems')
    end

    -----------------------

    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/operations/upload.rb:
    313:in `on_open': Net::SFTP::StatusException open /home/rems (4,
    "failure") (Net
    ::SFTP::StatusException open /home/rems (4, "failure"))
    from
    C:/RUBY/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `to
    _proc'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/request.
    rb:87:in `call'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/request.
    rb:87:in `respond_to'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.
    rb:947:in `dispatch_request'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.
    rb:910:in `when_channel_polled'
    from
    C:/RUBY/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `to
    _proc'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh/connection
    /channel.rb:311:in `call'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh/connection
    /channel.rb:311:in `process'
    ... 26 levels...
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.
    rb:801:in `loop'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.
    rb:786:in `connect!'
    from
    C:/RUBY/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp.rb:32:in
    `start'
    from testSFTP.rb:4

    ------------------------

    Server is Ubuntu 8.04, net-sftp 2.0.1 (same on linux and windows).

    Runing sftp from prompt allows me to put file on server.

    sftp.download!('/home/rems/sometest', '/temp') works ok.


    What am I missing?


    by
    TheR
    --
    Posted via http://www.ruby-forum.com/.
    Damjan Rems, Sep 23, 2008
    #1
    1. Advertising

  2. Damjan Rems

    Damjan Rems Guest

    Nevermind. I found out that destination filename must be specified.

    sftp.upload!('testSFTP.rb', '/home/rems/testSFTP.rb')


    by
    TheR


    When nothing helps, read the documentation.
    --
    Posted via http://www.ruby-forum.com/.
    Damjan Rems, Sep 23, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jamis Buck

    [ANN] Net::SFTP 0.5.0

    Jamis Buck, Dec 2, 2004, in forum: Ruby
    Replies:
    0
    Views:
    126
    Jamis Buck
    Dec 2, 2004
  2. Jamis Buck
    Replies:
    0
    Views:
    99
    Jamis Buck
    Jun 18, 2005
  3. Robin Walker

    Problem with Net::SFTP

    Robin Walker, Aug 19, 2009, in forum: Ruby
    Replies:
    1
    Views:
    112
    Robin Walker
    Aug 19, 2009
  4. MaggotChild

    Net::SFTP Fails, sftp OK

    MaggotChild, Oct 28, 2009, in forum: Perl Misc
    Replies:
    2
    Views:
    970
    C.DeRykus
    Oct 29, 2009
  5. Kevin13
    Replies:
    3
    Views:
    923
    Kevin13
    Dec 1, 2009
Loading...

Share This Page