title: Tunneling to a Postgresql Server using identity-file
body: <p>I'm trying to create a tunnel to a remote server, using this command:</p>
  
  <pre><code>sudo ssh -i ~/.ssh/id_rsa -g -L 5433:remote-ip:5432 user@dbserver.com -v
  </code></pre>
  
  <p>So, the goal is to set up tunnel that listens on local port 5433 and redirects the request to dbserver.com:5432</p>
  
  <p>I have Teampostgresql set up on my local machine and try to connect to the remote DB, using the tunnel.</p>
  
  <p>When I set up the tunnel and try to connect, I can see the following message in the terminal window:</p>
  
  <pre><code>debug1: channel 3: free: direct-tcpip: listening port 5433 for 127.0.0.1 port 5432,
  connect from 127.0.0.1 port 51893 to 127.0.0.1 port 5433, nchannels 5
  </code></pre>
  
  <p>Unfortunately, it's not working. 
  Any ideas what I'm doing wrong?</p>
  
  <p>[Edit]</p>
  
  <p>Changed the localhost to remote-host IP, as recommended by the first commenter (who, interestingly, deleted the comment)...</p>
  
  <p>[Edit2]</p>
  
  <p>As per request, the results from <code>netstat -nlp | grep 5432</code></p>
  
  <pre><code>tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -                   
  unix  2      [ ACC ]     STREAM     LISTENS         15963    -                    /tmp/.s.PGSQL.5432
  unix  2      [ ACC ]     STREAM     LISTENS         15961    -                    /var/run/postgresql/.s.PGSQL.5432
  </code></pre>