I have a remote server that I can SSH into no problem. I have PostgreSQL (ps) set up on the remote server (called 'enc') and local machine, both running on 5432 (the default). The remote server does not allow connections from outside connections (local web server goes directly to it).
I am trying to set up an SSH tunnel to make running commands on the remote ps server easier than copying files across, logging into the server and running them manually on that end.
I have tried running the following command
ssh -N -L 5555:enc:5432 enc
The tunnel appears to set up correctly but when I try to connect to the remote machine with
psql -p 5555
it says it is not working
psql: could not connect to server: No such file or directory. Is the server running locally and accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5555"?
Is this likely a problem with settings on the tunnel or restrictive user permissions (I imagine that the error would be different if that were the case)?