Обсуждение: Connecting from xp to linux server

Поиск
Список
Период
Сортировка

Connecting from xp to linux server

От
Simone Gadenz
Дата:
Hi all,

this is the problem I am facing.

I have PG 8.3 running on a KUBUNTU installation running on a virtual
machine. From inside the virtual machine I can use PGADMIN to manage PG
but when I try to connect from the xp machine I have this error: "Error
connecting to the server:FATAL: missing or erroneous pg_hba.conf file" .

I set the permission in the pg_hba.conf on the server.

The machine talk each oher, I can ping and use telnet on the 5432 port.

The log on the server does not report any problem.

Ideas?

--






  Dr. Simone Gadenz



via P. Togliatti 69, 50051

Castelfiorentino (FI)



+39 339 6053660







*INFORMATIVA PRIVACY (ex D.lgs. 196/03)*

Le inormazioni contenute in questo documento e nei relativi allegato

possono essere riservate e sono destinate esclusivamente alla persona

od alla Società indicata come destinatario.

La diffusione e la distribuzione del presente documento a soggetti

diversi da quelli indicati, od in genere qualsivoglia utilizzo illecito

dei dati ivi contenuti, e proibita sia ai sensi dell'art. 616 del

Codice Penale che dal D.Lgs 196/03 in materia di protezione dei dati

personali (Privacy).

Se avete ricevuto per errore questo documento siete pregati di

distruggerlo e di comunicarcelo prontamente tramite e-mail o fax.


Re: Connecting from xp to linux server

От
Shane Ambler
Дата:
Simone Gadenz wrote:
> Hi all,
>
> this is the problem I am facing.
>
> I have PG 8.3 running on a KUBUNTU installation running on a virtual
> machine. From inside the virtual machine I can use PGADMIN to manage PG
> but when I try to connect from the xp machine I have this error: "Error
> connecting to the server:FATAL: missing or erroneous pg_hba.conf file" .
>
> I set the permission in the pg_hba.conf on the server.
>
> The machine talk each oher, I can ping and use telnet on the 5432 port.
>
> The log on the server does not report any problem.
>
> Ideas?
>

If you can telnet then I would say your network and firewall is right
and the error with pg_hba.conf is where you need to look.

The pg_hba.conf is located in the data dir that you have specified for
postgresql. Is it there? What entries do you have after all the
comments? The errornous part would indicate a small syntax error or did
you edit it on windows with cr/nl characters and copy it across to linux?



--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

Re: Connecting from xp to linux server

От
Tom Lane
Дата:
Simone Gadenz <s.gadenz@geologyx.it> writes:
> I have PG 8.3 running on a KUBUNTU installation running on a virtual
> machine. From inside the virtual machine I can use PGADMIN to manage PG
> but when I try to connect from the xp machine I have this error: "Error
> connecting to the server:FATAL: missing or erroneous pg_hba.conf file" .

Look into the postmaster log to get more details about what it didn't
like.

(Also, consider using a client that doesn't throw away the HINT part
of an error message ...)

            regards, tom lane

Re: Connecting from xp to linux server

От
Simone Gadenz
Дата:
Shane,

I attached the pg_hba.conf I have on the server. I can use pgadmin3 when
I connect from the server itself, so I think the pg_hba on the server is
correct.

 From the client machine I cannot connect through pgadmin3. Is there
another way to test connection client server? Has pg a textual client to
send sql statements?

Thanks a lot

Simone



Shane Ambler ha scritto:
> Simone Gadenz wrote:
>> Hi all,
>>
>> this is the problem I am facing.
>>
>> I have PG 8.3 running on a KUBUNTU installation running on a virtual
>> machine. From inside the virtual machine I can use PGADMIN to manage PG
>> but when I try to connect from the xp machine I have this error: "Error
>> connecting to the server:FATAL: missing or erroneous pg_hba.conf file" .
>>
>> I set the permission in the pg_hba.conf on the server.
>>
>> The machine talk each oher, I can ping and use telnet on the 5432 port.
>>
>> The log on the server does not report any problem.
>>
>> Ideas?
>>
>
> If you can telnet then I would say your network and firewall is right
> and the error with pg_hba.conf is where you need to look.
>
> The pg_hba.conf is located in the data dir that you have specified for
> postgresql. Is it there? What entries do you have after all the
> comments? The errornous part would indicate a small syntax error or
> did you edit it on windows with cr/nl characters and copy it across to
> linux?
>
>
>


--






  Dr. Simone Gadenz



via P. Togliatti 69, 50051

Castelfiorentino (FI)



+39 339 6053660







*INFORMATIVA PRIVACY (ex D.lgs. 196/03)*

Le inormazioni contenute in questo documento e nei relativi allegato

possono essere riservate e sono destinate esclusivamente alla persona

od alla Società indicata come destinatario.

La diffusione e la distribuzione del presente documento a soggetti

diversi da quelli indicati, od in genere qualsivoglia utilizzo illecito

dei dati ivi contenuti, e proibita sia ai sensi dell'art. 616 del

Codice Penale che dal D.Lgs 196/03 in materia di protezione dei dati

personali (Privacy).

Se avete ricevuto per errore questo documento siete pregati di

distruggerlo e di comunicarcelo prontamente tramite e-mail o fax.

# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file.  A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of these forms:
#
# local      DATABASE  USER  METHOD  [OPTION]
# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostssl    DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostnossl  DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof.  In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask.  Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "crypt", "password", "gss", "sspi",
# "krb5", "ident", "pam" or "ldap".  Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTION is the ident map or the name of the PAM service, depending on METHOD.
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can use
# "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#




# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database
# super user can access the database using some other method.
# Noninteractive
# access to all databases is required during automatic maintenance
# (autovacuum, daily cronjob, replication, and similar tasks).
#
# Database administrative login by UNIX sockets
local   all         postgres                          ident sameuser

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
host    all         all         192.168.1.101         md5
host    all         all         192.168.159.1         md5
host    all         all         192.168.148.1         md5

# connections for all the pcs on the subnet
#
# TYPE    DATABASE    USER    IP-ADDRESS    IP-MASK METHOD
host    all             all     192.168.148.0   255.255.255.0
host    all             all     192.168.159.0   255.255.255.0

Re: Connecting from xp to linux server

От
Ivo Rossacher
Дата:
The attached pg_hba.conf file does have several mistakes in.
Every entry needs a mask or cidr and an auth-method. Pleas see the manual at
chapter 21.1 for details about the different formats which are recognized.

psql is a command line tool to access a database.

Best regards
Ivo

Am Montag, 9. Juni 2008 23:15:14 schrieb Simone Gadenz:
> Shane,
>
> I attached the pg_hba.conf I have on the server. I can use pgadmin3 when
> I connect from the server itself, so I think the pg_hba on the server is
> correct.
>
>  From the client machine I cannot connect through pgadmin3. Is there
> another way to test connection client server? Has pg a textual client to
> send sql statements?
>
> Thanks a lot
>
> Simone
>
> Shane Ambler ha scritto:
> > Simone Gadenz wrote:
> >> Hi all,
> >>
> >> this is the problem I am facing.
> >>
> >> I have PG 8.3 running on a KUBUNTU installation running on a virtual
> >> machine. From inside the virtual machine I can use PGADMIN to manage PG
> >> but when I try to connect from the xp machine I have this error: "Error
> >> connecting to the server:FATAL: missing or erroneous pg_hba.conf file" .
> >>
> >> I set the permission in the pg_hba.conf on the server.
> >>
> >> The machine talk each oher, I can ping and use telnet on the 5432 port.
> >>
> >> The log on the server does not report any problem.
> >>
> >> Ideas?
> >
> > If you can telnet then I would say your network and firewall is right
> > and the error with pg_hba.conf is where you need to look.
> >
> > The pg_hba.conf is located in the data dir that you have specified for
> > postgresql. Is it there? What entries do you have after all the
> > comments? The errornous part would indicate a small syntax error or
> > did you edit it on windows with cr/nl characters and copy it across to
> > linux?



Re: Connecting from xp to linux server

От
"Scott Marlowe"
Дата:
On Mon, Jun 9, 2008 at 3:15 PM, Simone Gadenz <s.gadenz@geologyx.it> wrote:
> Shane,
>
> I attached the pg_hba.conf I have on the server. I can use pgadmin3 when I
> connect from the server itself, so I think the pg_hba on the server is
> correct.

No, that just means that this one line:

local   all         postgres                          ident sameuser

is correct.

> From the client machine I cannot connect through pgadmin3. Is there another
> way to test connection client server? Has pg a textual client to send sql
> statements?

psql

All other comments stand as well, you don't have proper net masks on
the entries, and we don't know which ips you're trying to connect
from, so...

Re: Connecting from xp to linux server

От
Shane Ambler
Дата:
Simone Gadenz wrote:
> Shane,
>
> I attached the pg_hba.conf I have on the server. I can use pgadmin3 when
> I connect from the server itself, so I think the pg_hba on the server is
> correct.
>
>  From the client machine I cannot connect through pgadmin3. Is there
> another way to test connection client server? Has pg a textual client to
> send sql statements?
>
> Thanks a lot
>
> Simone
>
>

# connections for all the pcs on the subnet
#
# TYPE    DATABASE    USER    IP-ADDRESS    IP-MASK METHOD
host    all             all     192.168.148.0   255.255.255.0
host    all             all     192.168.159.0   255.255.255.0


try adding the method to the end of these lines.


# METHOD can be "trust", "reject", "md5", "crypt", "password", "gss",
"sspi",
# "krb5", "ident", "pam" or "ldap".  Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.


--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

Re: Connecting from xp to linux server

От
Simone Gadenz
Дата:
Thanks everybody! In fact it was a syntax problem. Now it works fine.

Cheers

Simone



Shane Ambler ha scritto:
> Simone Gadenz wrote:
>> Shane,
>>
>> I attached the pg_hba.conf I have on the server. I can use pgadmin3
>> when I connect from the server itself, so I think the pg_hba on the
>> server is correct.
>>
>>  From the client machine I cannot connect through pgadmin3. Is there
>> another way to test connection client server? Has pg a textual client
>> to send sql statements?
>>
>> Thanks a lot
>>
>> Simone
>>
>>
>
> # connections for all the pcs on the subnet
> #
> # TYPE    DATABASE    USER    IP-ADDRESS    IP-MASK METHOD
> host    all             all     192.168.148.0   255.255.255.0
> host    all             all     192.168.159.0   255.255.255.0
>
>
> try adding the method to the end of these lines.
>
>
> # METHOD can be "trust", "reject", "md5", "crypt", "password", "gss",
> "sspi",
> # "krb5", "ident", "pam" or "ldap".  Note that "password" sends passwords
> # in clear text; "md5" is preferred since it sends encrypted passwords.
>
>


--






  Dr. Simone Gadenz



via P. Togliatti 69, 50051

Castelfiorentino (FI)



+39 339 6053660







*INFORMATIVA PRIVACY (ex D.lgs. 196/03)*

Le inormazioni contenute in questo documento e nei relativi allegato

possono essere riservate e sono destinate esclusivamente alla persona

od alla Società indicata come destinatario.

La diffusione e la distribuzione del presente documento a soggetti

diversi da quelli indicati, od in genere qualsivoglia utilizzo illecito

dei dati ivi contenuti, e proibita sia ai sensi dell'art. 616 del

Codice Penale che dal D.Lgs 196/03 in materia di protezione dei dati

personali (Privacy).

Se avete ricevuto per errore questo documento siete pregati di

distruggerlo e di comunicarcelo prontamente tramite e-mail o fax.