Here's the situation:
I have SSH access to ServerA
I have SFTP access to ServerB, but only from ServerA
I want to use Ruby to SSH into ServerA, then SFTP files from ServerB to ServerA.
I can connect to ServerA using the documentation from Net::SSH:
require 'net/ssh/gateway'
gateway = Net::SSH::Gateway.new('server_a', 'user')
gateway.ssh("server_a", "user") do |ssh|
# how to SFTP into server_b here and run SFTP commands?
end
gateway.shutdown!
What I can't figure out is how to SFTP into ServerB from the context of ServerA?