Re: - Mailing list pgadmin-support

From fred@ontosys.com
Subject Re:
Date
Msg-id 20011220115344.A1785@ontosys.com
Whole thread Raw
In response to Re:  (Dave Page <dpage@vale-housing.co.uk>)
List pgadmin-support
On Thu, Dec 20, 2001 at 04:22:41PM -0000, Dave Page wrote:
> > Can you tell me exactly how to tunnel?  I'm not sure I'm
> > doing it correctly. How do I know if its working?
>
> Sorry Peter, I've never done it and don't have a clue how. Fred (if you're
> reading this :-) ), do you have a couple of minutes to give some pointers on
> this?

Executive summary:

  + Set up a local machine (call it "mylocalhost") to forward, via
    SSH, local port 35432 to remote port 5432 on the Postgres server
    (call it "dbhost").

  + Connect via pgAdmin to port 35432 on mylocalhost.


Details (specific to OpenSSH on mylocalhost):

+ Add the following to $HOME/.ssh/config in mylocalhost:

    Host dbhost
        Hostname dbhost.com
        User mynameondbhost
        LocalForward 35432 dbhost.com:5432
        GatewayPorts yes

  The 35432 port number is arbitrary.  GatewayPorts must be allowed if
  you're running pgAdmin on a different machine than mylocalhost.  In
  my case, mylocalhost is a Linux box on my LAN.

+ Open an ssh connection from mylocalhost to dbhost, and leave it open:

    $ ssh dbhost

  These first two steps can be combined by using command-line
  parameters to ssh to specify the port-forwarding, but I prefer to
  use the config file method.

+ Add the following to the pg_hba.conf file on dbhost:

    host    all    nnn.nnn.nnn.nnn   255.255.255.255 password

  where 'nnn.nnn.nnn.nnn' is the IP address of dbhost.  I found that
  it didn't suffice to just have the standard similar entries for
  'local ...' and 'host all 127.0.0.1 ...'.

+ Run pgAdmin and connect to mylocalhost:

    Server:   mylocalhost
    Port:      35432
    Username: [as normal]
    Password: [as normal]

+ When done with pgAdmin you may wish to tear down the ssh connection.

Note that the same forwarded port can be used with all the other
Postgres utilities:

    $ psql -h mylocalhost -p 35432 -l -U postgres
    $ pg_dump -h mylocalhost -p 35432 -u some_db_name
    etc

--
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re:
Next
From: Dave Page
Date:
Subject: Re: