From: Luis Lavena Date: 2008-04-16T07:25:05+09:00 Subject: Re: Windows, Net::SSH: how do I use a private key (w / password) On Apr 15, 6:45 pm, James Dinkel wrote: > Private key authentication works with this user, I know because I use it > fine with Putty. > > Here is my script right now: > ------------ > require 'rubygems' > require 'net/ssh' > > Net::SSH.start( 'files02', 'myuser', 'mypassword' ) do |session| > session.open_channel do |channel| > channel.on_data do |ch, data| > puts data > end > > channel.exec "echo \"hello\"" > > end > > session.loop > end > ------------- > > and it works, but I would prefer it to use a private key for the > authentication and then prompt for the key's password. In the > documentation it says it will automatically look for a key in certain > places, but the places are unix paths and this needs to run from a > Windows (XP) box. You will need a few things: Pageant (from PuTTY) is like a ssh keyring that hold all your private keys. Also, you need to create a PuTTY session with the same name of your server (files02) and put into Connection -> Data the username you're using to log into the server. That's what I'm using with capistrano and other Net::SSH things that I cannot disclose, and worked without issues. HTH, -- Luis Lavena