Ruby Net::SCP download asking for password then failing

I'm trying to download a file to an in-memory buffer from a unix box then upload the file to another unix box, but when I try to download the file it asks for my password then fails even if I put it in. I've tried both:

data = Net::SCP.download!("remote.host.com", "username", "/remote/path", :password => password)

and

data = Net::SCP::download!("remote.host.com", "username", "/remote/path", :password => password)

but I get:

Active Directory Password:

Then when I enter my password:

Net::SCP::Error: SCP did not finish successfully (1)

ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32] net-scp (1.0.4)

Answers


Try to use it like this:

require 'net/scp'

data = nil
Net::SCP.start("remote.host.com", "username", :password => "password") do |scp|
  data = scp.download!("/remote/path")
end

puts data

EDIT: I only tried this on ruby ruby-1.9.3, sorry


Need Your Help

ASP.NET Life cycle. Saving Session to database

asp.net session-state

I have an ASP.NET application that is using the SQLServer Session mode. I Created the below property in my page.

Binary Search Tree

binary binary-tree binary-search binary-search-tree

My professor posted some review questions for the final exam. And I can't seem to find the answers for it. Any help will be greatly appreciated!

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.