Hi all
I have a small problem here: I try to upload a file using SCP and Ruby to a server using a private key. The code looks like:
def transfer_file(source_file, destination_file)
$log.info("ScpDP: Key=#{@key}")
Net::SCP.start(@host, @userName, :keys => @key ) do |scp|
scp.upload!(source_file,@folder + destination_file, :ssh => @key)
end
end
However there is some problem (and not with the private key, since we use it for daily purposes :) ) and I get the following log errror:
I, [2010-08-24T11:21:27.247847 #14310] INFO -- : ScpDP: Key=/home/myself/.ssh/id_rsa
I, [2010-08-24T11:21:27.397971 #14310] INFO -- : SCP did not finish successfully (1) (Net::SCP::Error)
/usr/lib/ruby/gems/1.8/gems/net-scp-1.0.2/lib/net/scp.rb:351:in `start_command'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/channel.rb:585:in `call'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/channel.rb:585:in `do_close'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:575:in `channel_close'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:455:in `send'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:455:in `dispatch_incoming_packets'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:212:in `preprocess'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:196:in `process'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:160:in `loop'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:160:in `loop_forever'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:160:in `loop'
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.11/lib/net/ssh/connection/session.rb:109:in `close'
/usr/lib/ruby/gems/1.8/gems/net-scp-1.0.2/lib/net/scp.rb:204:in `start'
/home/myself/work/server.rb:458:in `transfer_file'
Can you please point out what might be wrong here? I have quite limited Ruby experience at this stage :(
Thanks, f