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

A

Ad Ad

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.
 
S

Sandor Szücs

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/index.html
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
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top