Connecting via ssh tunnel
Hi,
I have a postgresql server setup on a Solaris 10 box. I can connect to
the db via psql from the local machine. What I have been trying to do
it connect with pgAdmin from my workstation. I have setup the tunnel
correctly, local port 5432 and destination localhost:5432. Everytime I
try to connect I get the following message.
2006-11-24 20:42:48 ERROR : Error connecting to the server: server
closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
I havent altered the config files, so postgresql should be listening
on localhost.
Any one got any ideas?
Ben
"ben short" <ben@benshort.co.uk> writes:
I have a postgresql server setup on a Solaris 10 box. I can connect to
the db via psql from the local machine. What I have been trying to do
it connect with pgAdmin from my workstation. I have setup the tunnel
correctly, local port 5432 and destination localhost:5432.
Surely that is not a correct tunnel setup ... you can't have both ends
being the same port number on the same machine. There Can Be Only One
process listening on a given port per machine.
regards, tom lane
Hi,
I have a postgresql server setup on a Solaris 10 box. I can connect to
the db via psql from the local machine. What I have been trying to do
it connect with pgAdmin from my workstation. I have setup the tunnel
correctly, local port 5432 and destination localhost:5432. Everytime I
try to connect I get the following message.2006-11-24 20:42:48 ERROR : Error connecting to the server: server
closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.I havent altered the config files, so postgresql should be listening
on localhost.
on solaris :
telnet localhost 5432 does connect ?
Any one got any ideas?
Ben
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
leonel
On Friday 24 November 2006 12:56, ben short wrote:
Hi,
I have a postgresql server setup on a Solaris 10 box. I can connect to
the db via psql from the local machine. What I have been trying to do
it connect with pgAdmin from my workstation. I have setup the tunnel
correctly, local port 5432 and destination localhost:5432. Everytime I
try to connect I get the following message.
I guess the tunnel isn't correct. You connect on the same ports - seems wrong
to me. I'm using a tunnel like this:
ssh -l <user> -L 5555:localhost:5432 <servername>
and then connect psql on the client machine with
psql -h localhost -p 5555 -U <user> <dbname>
Uwe
--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416
On Fri, Nov 24, 2006 at 04:42:56PM -0500, Tom Lane wrote:
Surely that is not a correct tunnel setup ... you can't have both ends
being the same port number on the same machine. There Can Be Only One
process listening on a given port per machine.
I think he is refering the -L option of ssh that specifies that the given
port on the local (client) host is to be forwarded to the given host and
port on the remote side. I do this on a test web server all the time:
-L8080:localhost:8080 If I enter the url localhost:8080 in the browser
it is forwarded on to the remote via the ssh tunnel.
Hi all!
pgsql-general-owner@postgresql.org wrote:
On Friday 24 November 2006 12:56, ben short wrote:
I have a postgresql server setup on a Solaris 10 box. I can
connect to the db via psql from the local machine. What I have
been trying to do it connect with pgAdmin from my workstation. I
have setup the tunnel correctly, local port 5432 and destination
localhost:5432. Everytime I try to connect I get the following
message.I guess the tunnel isn't correct. You connect on the same ports -
seems wrong to me. I'm using a tunnel like this:ssh -l <user> -L 5555:localhost:5432 <servername>
actually
ssh -l USER -L 5432:localhost:5432 SOMEOTHERHOSTTHANLOCALHOST
is ok. the "localhost" part is evaluated on the SOMEOTHERHOST
and dns lookup is done there. I have been bitten by this before.
If SOMEOTHERHOST is the same host, this would obviously not
work, since the ssh tunnel and the postgres server cannot
listen on the same port.
I am not sure if the error message you are seeing is the same
one you would get when a connection is impossible. To me it
looks like a connection was initiated by the server closed
it.
Regards
Jan
Import Notes
Resolved by subject fallback
Ok I have fixed it.
My port fowarding was fine but i needed to set AllowTcpForwarding to
yes in sshd_config.
Ben
Show quoted text
On 11/27/06, Weerts, Jan <j.weerts@i-views.de> wrote:
Hi all!
pgsql-general-owner@postgresql.org wrote:
On Friday 24 November 2006 12:56, ben short wrote:
I have a postgresql server setup on a Solaris 10 box. I can
connect to the db via psql from the local machine. What I have
been trying to do it connect with pgAdmin from my workstation. I
have setup the tunnel correctly, local port 5432 and destination
localhost:5432. Everytime I try to connect I get the following
message.I guess the tunnel isn't correct. You connect on the same ports -
seems wrong to me. I'm using a tunnel like this:ssh -l <user> -L 5555:localhost:5432 <servername>
actually
ssh -l USER -L 5432:localhost:5432 SOMEOTHERHOSTTHANLOCALHOSTis ok. the "localhost" part is evaluated on the SOMEOTHERHOST
and dns lookup is done there. I have been bitten by this before.
If SOMEOTHERHOST is the same host, this would obviously not
work, since the ssh tunnel and the postgres server cannot
listen on the same port.I am not sure if the error message you are seeing is the same
one you would get when a connection is impossible. To me it
looks like a connection was initiated by the server closed
it.Regards
Jan
On Nov 24, 2006, at 2:56 PM, ben short wrote:
I have a postgresql server setup on a Solaris 10 box. I can connect to
the db via psql from the local machine. What I have been trying to do
it connect with pgAdmin from my workstation. I have setup the tunnel
correctly, local port 5432 and destination localhost:5432. Everytime I
try to connect I get the following message.2006-11-24 20:42:48 ERROR : Error connecting to the server: server
closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.I havent altered the config files, so postgresql should be listening
on localhost.
I *think* that's pointing at a pg_hba.conf issue; is there anything
in the logs?
Send *exact details* of how you're setting this up and someone might
be able to help further...
--
Jim Nasby jim@nasby.net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
On Monday 27 November 2006 02:38, Weerts, Jan wrote:
Hi all!
pgsql-general-owner@postgresql.org wrote:
On Friday 24 November 2006 12:56, ben short wrote:
I have a postgresql server setup on a Solaris 10 box. I can
connect to the db via psql from the local machine. What I have
been trying to do it connect with pgAdmin from my workstation. I
have setup the tunnel correctly, local port 5432 and destination
localhost:5432. Everytime I try to connect I get the following
message.I guess the tunnel isn't correct. You connect on the same ports -
seems wrong to me. I'm using a tunnel like this:ssh -l <user> -L 5555:localhost:5432 <servername>
actually
ssh -l USER -L 5432:localhost:5432 SOMEOTHERHOSTTHANLOCALHOSTis ok. the "localhost" part is evaluated on the SOMEOTHERHOST
and dns lookup is done there. I have been bitten by this before.
If SOMEOTHERHOST is the same host, this would obviously not
work, since the ssh tunnel and the postgres server cannot
listen on the same port.
Thinking about it I agree that this would work, unless you have postgresql
running on localhost (which is the case in my installation)
Uwe
--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416