net/sftp problem

D

Damjan Rems

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
 
D

Damjan Rems

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top