I'm trying to create a tunnel to a remote server, using this command:
sudo ssh -i ~/.ssh/id_rsa -g -L 5433:remote-ip:5432 [email protected] -v
So, the goal is to set up tunnel that listens on local port 5433 and redirects the request to dbserver.com:5432
I have Teampostgresql set up on my local machine and try to connect to the remote DB, using the tunnel.
When I set up the tunnel and try to connect, I can see the following message in the terminal window:
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
Unfortunately, it's not working. Any ideas what I'm doing wrong?
[Edit]
Changed the localhost to remote-host IP, as recommended by the first commenter (who, interestingly, deleted the comment)...
[Edit2]
As per request, the results from netstat -nlp | grep 5432
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