From: Gordon Thiesfeld Date: 2008-04-16T20:47:58+09:00 Subject: Re: Windows, Net::SSH: how do I use a private key (w / passw On Wed, Apr 16, 2008 at 12:33 AM, James Dinkel wrote: > > I actually generated the key with ssh-keygen on the linux server (which > needs to be converted to use with Putty, but I expect to use the > unconverted key with the ruby script). What is the syntax of using the > :key parameter? Is it like this? > > Net::SSH.start( 'files02', :keys=>['C:\\key_name'] ) do |session| > > assuming of course the key file is named 'key_name' and resides directly > under the c: drive. Do you put in the name the public key to? (With > Putty and openSSH clients I only need the private key on the client) > Here's what I tried, the keys are in the same directory as the script, so no path. C:\ruby>ruby -v ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32] C:\ruby>gem li net-ssh *** LOCAL GEMS *** net-ssh (1.1.2) # test_ssh.rb require 'net/ssh' Net::SSH.start( 'local' , :keys =>['private_key.priv']) do |session| # do stuff end I had to rename my public key to private_key.priv.pub (so, name of private key, with a .pub extension), or it would throw an error. Right now, I'm testing against a cygwin ssh server on my local machine. I'll look at it some more when I get in to work and can test against a "proper" ssh server.