From: Gordon Thiesfeld Date: 2008-04-17T00:04:15+09:00 Subject: Re: Windows, Net::SSH: how do I use a private key (w / passw On Wed, Apr 16, 2008 at 7:24 AM, Robert Dober wrote: > On Wed, Apr 16, 2008 at 6:01 AM, Gordon Thiesfeld wrote: > > > > I think you can probably do this now, but there are some quirks. You > > can pass in a :keys option to Net::SSH.start[1] and point it to your > > keys (I think you need both the private and public key on your side). > > Also, putty private keys aren't the same as OpenSSH keys. PuttyGen > > has an option to convert to OpenSSH keys, but I didn't have any luck > > using that with Net::SSH. > AFAIR you still need to use keygen to convert the key a second time. I > know it does not make a lot of sense but happened to me, but maybe the > person sending me the key made an error on the client ( spelling as > PuTTY ) > HTH > Robert Ok, the trick for me was to export the PuTTY private key to an OpenSSH key in PuTTYgen, then cut and paste the public key into a file, rather than using the "Save public key" button. C:\ruby\scripts\ssh_test>dir /b key key.pub ssh.rb C:\ruby\scripts\ssh_test>ssh.rb Wed Apr 16 10:01:24 CDT 2008 # ssh.rb require 'net/ssh' Net::SSH.start( 'server' , :keys =>['key']) do |s| s.process.popen3( "date" ){ |input, output, error| puts output.read } end