title: SSH -L connection successful, but localhost port forwarding not working "channel 3: open failed: connect failed: Connection refused"
body: <p>My lab runs RStudio on a server.  A couple weeks ago, from my cousin's house, I successfully ssh'd into the server and pulled up the server-side RStudio through my local Firefox browser.  Now when I try to access the server RStudio from home (via my own router), it doesn't work.  I need help troubleshooting, and I'm guessing it's some problem on the router.  I'm running Mac OSX 10.6.8.  No idea what the university server's running, but I don't think it's a server-side problem.</p>
  
  <p>Here's how it worked the first time I did it, at my cousin's house: first, I VPN into the university network; then I call SSH with port forwarding; then I open a Firefox browser, connect to my localhost port, and it opens up RStudio on the server side which I can access through my local browser window.</p>
  
  <p>Here's the problem I'm having right now when I try to log-in from my home network:</p>
  
  <p>I can make the VPN connection successfully.  I can also set up SSH successfully with this command:
  <code>ssh -v -L 8783:localhost:8783 myacct@server.com</code></p>
  
  <p>Here are the last several lines of the verbose output from the successful ssh command:</p>
  
  <pre><code>debug1: Authentication succeeded (password).
  debug1: Local connections to LOCALHOST:8783 forwarded to remote address localhost:8783
  debug1: Local forwarding listening on 127.0.0.1 port 8783.
  debug1: channel 0: new [port listener]
  debug1: Local forwarding listening on ::1 port 8783.
  debug1: channel 1: new [port listener]
  debug1: channel 2: new [client-session]
  debug1: Entering interactive session.
  Last login: Mon Sep  2 04:02:40 2013 from vpnipaddress
  </code></pre>
  
  <p>So I think I'm still succeeding at the VPN and SSH stage (though I don't know why it says my last login was Sep 2 when I've logged in a few times since then).</p>
  
  <p>Next, I open Firefox, and I type localhost:8783, and instead of getting an RStudio server app through my browser window, I get the following errors:</p>
  
  <p>In the Firefox browser window, it says: Server not found, Firefox can't find the server at www.localhost.com, Check the address for typing errors etc.</p>
  
  <p>In the terminal window, it says:</p>
  
  <pre><code>debug1: Connection to port 8783 forwarding to localhost port 8783 requested.
  debug1: channel 3: new [direct-tcpip]
  channel 3: open failed: connect failed: Connection refused
  debug1: channel 3: free: direct-tcpip: listening port 8783 for localhost port 8783, connect from 127.0.0.1 port 50420, nchannels 4
  </code></pre>
  
  <p>I'm not sure what I've got wrong.  I haven't changed anything on my laptop since my last successful connection.  I'm on my own router (instead of my cousin's), so maybe I need to mess with the firewall?  I already allowed ports 22 and 8783 to come through the firewall to my laptop (I'm not even sure I needed to do that though).  Help?</p>