Обсуждение: psql -h host ...
In this command psql -h host ... does it look for pg_hba.conf in the client or in the server? James
On Mon, Jun 26, 2006 at 01:51:24PM -0700, James wrote: > In this command > psql -h host ... > > does it look for pg_hba.conf in the client or in the server? The server. Client machines do not necessarily have a pg_hba.conf and even if they do, clients are unlikely to be able to read it. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Вложения
James, the "psql" command as you know is just the command line program that requests connection to a database and depending how you issue the command, determines if it's attempting to connect to a local file, or via a network protocol (commonly TCP/IP). When you issue the command from a remote host, relative to where the database is located, once the database server receives the connection request, that request is looked up in the pg_hba.conf file to validate the user attempting the request. If the user meets the constraints imposed within, the user is granted access to the database, otherwise, "try again." If you launch the psql command directly on the server to connect locally to the database, in this scenario, the server is 'the client' and therefore would be looking up pg_hba.conf on 'the client' but this case is no different from the remote client to the server, in that there are still both roles being fulfilled and ultimately 'the server' is looking up the request in the pg_hba.conf. Hope this helps. Martijn van Oosterhout wrote: >On Mon, Jun 26, 2006 at 01:51:24PM -0700, James wrote: > > >>In this command >>psql -h host ... >> >>does it look for pg_hba.conf in the client or in the server? >> >> > >The server. Client machines do not necessarily have a pg_hba.conf and >even if they do, clients are unlikely to be able to read it. > >Have a nice day, > >
Thanks all for the reply. Once pg_hba.conf is modified, do I have to run pg_ctl reload ? James louis gonzales wrote: > James, > the "psql" command as you know is just the command line program that > requests connection to a database and depending how you issue the > command, determines if it's attempting to connect to a local file, or > via a network protocol (commonly TCP/IP). When you issue the command > from a remote host, relative to where the database is located, once the > database server receives the connection request, that request is looked > up in the pg_hba.conf file to validate the user attempting the request. > > If the user meets the constraints imposed within, the user is granted > access to the database, otherwise, "try again." > > If you launch the psql command directly on the server to connect locally > to the database, in this scenario, the server is 'the client' and > therefore would be looking up pg_hba.conf on 'the client' but this case > is no different from the remote client to the server, in that there are > still both roles being fulfilled and ultimately 'the server' is looking > up the request in the pg_hba.conf. > > Hope this helps. > > Martijn van Oosterhout wrote: > > >On Mon, Jun 26, 2006 at 01:51:24PM -0700, James wrote: > > > > > >>In this command > >>psql -h host ... > >> > >>does it look for pg_hba.conf in the client or in the server? > >> > >> > > > >The server. Client machines do not necessarily have a pg_hba.conf and > >even if they do, clients are unlikely to be able to read it. > > > >Have a nice day, > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq
James wrote: > Thanks all for the reply. > Once pg_hba.conf is modified, do I have to run > pg_ctl reload ? If in doubt check the documentation :) http://www.postgresql.org/docs/8.1/static/client-authentication.html#AUTH-PG-HBA-CONF "The pg_hba.conf file is read on start-up and when the main server process (postmaster) receives a SIGHUP signal. If you edit the file on an active system, you will need to signal the postmaster (using pg_ctl reload or kill -HUP) to make it re-read the file." So yes. -- Postgresql & php tutorials http://www.designmagick.com/