Net::SCP How to use ssh options?

Hi,

I’m trying to use custom SSH-Options with the modules Net::SCP

These are the used versions:

Ruby: 1.9.1
Net::SSH: 2.9.4 (Last Version that works with ruby 1.x)
Net::SCP: 1.2.1

In the documentation, there is the following to read:

http://net-ssh.github.io/scp/v1/api/classes/Net/SCP.html#M000006

== upload!(host, username, local, remote, options={}, &progress) ==

… If the options hash includes an :ssh key, the value for that will be
passed to the SSH connection as options (e.g., to set the password,
etc.). …

So I tried this:

Net::SCP.start(host, “root”) do |scp|
scp.upload! local_dir, remote_dir, :recursive => true , :ssh =>
[“PasswordAuthentication=no”,“PubkeyAuthentication=yes”]
end

This did not work. The Dialog for PasswordAuthentication is displayed
when the key is not allowed. Desired behaviour is that the connection
attempt fails immediately.

I also tried the :auth_methods Key. But that did not work either.

Thanks for any hints.

Regards,
Tobias

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs