class Net::SSH::Service::Forward
def agent(channel)
ssh.loop
end
# agent will be automatically forwarded by this point
ssh.open_channel do |ch|
Net::SSH.start("remote.host", "me", :forward_agent => true) do |ssh|
:forward_agent set to true:
time a session channel is opened, when the connection was created with
never need to call this directly--it is called automatically the first
used as the transport for enabling the forwarded connection. You should
will remain active even after the channel closes--the channel is only
Enables SSH agent forwarding on the given channel. The forwarded agent
def agent(channel) return if @agent_forwarded @agent_forwarded = true channel.send_channel_request("auth-agent-req@openssh.com") do |achannel, success| if success debug { "authentication agent forwarding is active" } else achannel.send_channel_request("auth-agent-req") do |a2channel, success2| if success2 debug { "authentication agent forwarding is active" } else error { "could not establish forwarding of authentication agent" } end end end end end