Skip to content

Instantly share code, notes, and snippets.

@mariussturm
Created September 13, 2010 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariussturm/577308 to your computer and use it in GitHub Desktop.
Save mariussturm/577308 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ssh/gateway'
gateway = Net::SSH::Gateway.new('remote_host', \
'remote_user', \
:auth_methods => ['publickey'], \
:forward_agent => true)
gateway.open('remote_host', remote_port, local_port) do |local_port|
puts local_port
while gateway.active? do
sleep 5
end
end
gateway.shutdown!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment