From: Maxwell Pray Date: 2012-05-15T03:29:44+09:00 Subject: net-ssh: Trouble forwarding local ports to a remote server Here's the plan: I need to forward a Samba connection on my machine to a remote server. When logging into the remote server, I should be able to run smbclient -L \\localhost and see the Samba server from my machine. Here's the script I'm running: require 'net/ssh' Net::SSH.start(hostname, user, :password => pass) do |sshConnection| sshConnection.forward.remote(445, 'localhost', 445) sshConnection.loop do sleep 0.5 ! sshConnection.forward.active_remotes.include?([445, '127.0.0.1']) end puts 'Connection open' sleep 60 end A chunk of this is just in there for testing, but within that 60-second window, I should be able to log in to the remote server and run that smbclient -L \\localhost command and see my shares, right? Currently, it's not working. Here's what I've found: - ssh -R 445:localhost:445 user@hostname forwards fine and I can see the shares (expected) - If the script isn't running and I run smbclient, I get an error about the server not running (expected) - If the script is running and I run smbclient, it hangs until the 60 seconds are up (unexpected) Any thoughts? -- Posted via http://www.ruby-forum.com/.