[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Net::SSH to login into a server with a public key

Ad Ad

5/15/2009 7:10:00 PM

Hi,
I have a remote server B which can only accessed via server A through a
public key.

Is there a way to do this in net/ssh ?

I have started an SSH session for A

Net::SSH.start("ServerA","username",:password=>"xyz") do |ssh|
#is there a way to now login into B?
#In putty I just do: ssh B and I am in
end

thanks.
--
Posted via http://www.ruby-....

2 Answers

Delano Mandelbaum

5/15/2009 8:06:00 PM

0

> Is there a way to do this in net/ssh ?

Take a look at Net::SSH::Gateway:
http://github.com/jamis/net-ssh-gateway/t...

And here's a wrapper that takes care of the details (which is really
useful if the environment gets more complex):
http://github.com/Narnach/s...

Delano

Sandor Szücs

5/17/2009 8:38:00 AM

0


On 15.05.2009, at 21:09, Ad Ad wrote:

> Hi,
> I have a remote server B which can only accessed via server A =20
> through a
> public key.
>
> Is there a way to do this in net/ssh ?

Yes it's very simple.
http://net-ssh.rubyforge.org/ssh/v2/api/...

> I have started an SSH session for A
>
> Net::SSH.start("ServerA","username",:password=3D>"xyz") do |ssh|
Net::SSH.start("ServerA","username",:keys=3D>["~/.ssh/id_rsa"]) do |ssh|
>
> #is there a way to now login into B?
> #In putty I just do: ssh B and I am in
> end



regards, Sandor Sz=FCcs
--