Thread: Administer postgres from PGAdmin on remote mac using ssh tunnel

Administer postgres from PGAdmin on remote mac using ssh tunnel

From
aidan
Date:
I've got PostgreSQL installed on a Ubuntu server and I'm trying to connect to
that server using PGAdmin on a remote macbook.

I've created an ssh tunnel -

macbook:~postgres$ ssh -L 5423:localhost:5432 postgres@mydomain.com
And I can connect using psql on the macbook as expected -

macbook:~ me$ psql -U postgres -p 5423 -h localhost
...
postgres=#
In the 'New Server Registration' window on PGAdminIII I'm entering the
following credentials -

Name - MyServer
Host - localhost
Port - 5423
Maintenance DB - postgres
Username - postgres
Password - <remote_postgres_password>
However the connection fails -

Error connecting to the server: FATAL: password authentication failed for
user "postgres"
Not sure what's going on here, these seem to be the same credentials I've
used for psql.

My pg_hba.conf file only has the following lines -

# Database administrative login by Unix domain socket
local   all             postgres                                peer
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Administer-postgres-from-PGAdmin-on-remote-mac-using-ssh-tunnel-tp5732503.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: Administer postgres from PGAdmin on remote mac using ssh tunnel

From
Guillaume Lelarge
Date:
On Fri, 2012-11-16 at 14:32 -0800, aidan wrote:
> I've got PostgreSQL installed on a Ubuntu server and I'm trying to connect to
> that server using PGAdmin on a remote macbook.
> 
> I've created an ssh tunnel -
> 
> macbook:~postgres$ ssh -L 5423:localhost:5432 postgres@mydomain.com
> And I can connect using psql on the macbook as expected -
> 
> macbook:~ me$ psql -U postgres -p 5423 -h localhost
> ...
> postgres=#
> In the 'New Server Registration' window on PGAdminIII I'm entering the
> following credentials -
> 
> Name - MyServer
> Host - localhost
> Port - 5423
> Maintenance DB - postgres
> Username - postgres
> Password - <remote_postgres_password>
> However the connection fails -
> 
> Error connecting to the server: FATAL: password authentication failed for
> user "postgres"
> Not sure what's going on here, these seem to be the same credentials I've
> used for psql.
> 
> My pg_hba.conf file only has the following lines -
> 
> # Database administrative login by Unix domain socket
> local   all             postgres                                peer
> # "local" is for Unix domain socket connections only
> local   all             all                                     peer
> # IPv4 local connections:
> host    all             all             127.0.0.1/32            md5
> # IPv6 local connections:
> host    all             all             ::1/128                 md5
> 

Did you try to use psql through your SSH tunnel? because it works for me
with psql and pgAdmin.

The error message you got means you didn't enter the right password.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com