authentication failed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bogdan Chytrek

    authentication failed

    Why happens this?

    Warning: pg_connect() unable to connect to PostgreSQL server: FATAL:
    IDENT authentication failed for user "bchytrek" in
    /var/www/html/physio2/test.php on line 19

    The php-statement is :

    $conn = pg_connect("dbn ame=testdb user=bchytrek") ;

    the owner of that testdb is bchytrek and he does not have a password, he
    is in the users-list as superuser, an may cerate dbs.

    So why does the authentication fail?

    Helpless

    Bogdan


    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

  • D. Dante Lorenso

    #2
    Re: authentication failed


    Bogdan Chytrek wrote:
    [color=blue]
    >Why happens this?
    >
    >Warning: pg_connect() unable to connect to PostgreSQL server: FATAL:
    >IDENT authentication failed for user "bchytrek" in
    >/var/www/html/physio2/test.php on line 19
    >
    >The php-statement is :
    >
    >$conn = pg_connect("dbn ame=testdb user=bchytrek") ;
    >
    >the owner of that testdb is bchytrek and he does not have a password, he
    >is in the users-list as superuser, an may cerate dbs.
    >
    >So why does the authentication fail?
    >
    >
    >[/color]
    Check your pg_hba.conf and postgresql.conf files.

    I bet you forgot to turn on tcp/ip sockets, didn't you ;-)

    On my RedHat 9 box:

    -- /var/lib/pgsql/data/pg_hba.conf

    #TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
    local all all trust
    host all all 0.0.0.0 0.0.0.0 trust

    -- /var/lib/pgsql/data/postgresql.conf

    tcpip_socket = true

    Try starting with something like THIS ... then tighten the security
    after you get it to start working.

    Dante




    ---------------------------(end of broadcast)---------------------------
    TIP 3: if posting/reading through Usenet, please send an appropriate
    subscribe-nomail command to majordomo@postg resql.org so that your
    message can get through to the mailing list cleanly

    Comment

    • Tom Lane

      #3
      Re: authentication failed

      roboccc@t-online.de (Bogdan Chytrek) writes:[color=blue]
      > So why does the authentication fail?[/color]

      Because the PHP script is not running as Unix user bchytrek (most likely
      that process runs under some daemon userid or other). When you are
      using IDENT authentication, your Unix user name has to match your
      Postgres user name.

      You could possibly work around that by creating an IDENT map that allows
      the PHP daemon user to be accepted as bchytrek; see the admin guide for
      details. But more likely you'll just want to switch to a different
      authentication method.

      regards, tom lane

      ---------------------------(end of broadcast)---------------------------
      TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postg resql.org so that your
      message can get through to the mailing list cleanly

      Comment

      • Chris Travers

        #4
        Re: authentication failed

        Hi Bogdan;

        This is a typical problem when you install PosgreSQL via the Red Hat CD's.

        You need to edit the pg_hba.conf and change the authentication type to more
        appropriate settings. If your PHP app connects using a host field in the
        connection string, it will be using a network socket. Otherwise, it will be
        a local socket.

        I usually set my servers to use md5 authentication for all network
        connections and trust for local connections, allowing the admin to connect
        locally as any user, but this assumes a level of security and architecture
        you may not wish to assume. md5 authentication on both local and network
        sockets will force password authentication for all connections via a
        zero-knowledge md5-sum authentication method.

        Best Wishes,
        Chris Travers

        ----- Original Message -----
        From: "Bogdan Chytrek" <roboccc@t-online.de>
        To: <pgsql-general@postgre sql.org>
        Sent: Thursday, December 18, 2003 6:26 PM
        Subject: [GENERAL] authentication failed


        Why happens this?

        Warning: pg_connect() unable to connect to PostgreSQL server: FATAL:
        IDENT authentication failed for user "bchytrek" in
        /var/www/html/physio2/test.php on line 19

        The php-statement is :

        $conn = pg_connect("dbn ame=testdb user=bchytrek") ;

        the owner of that testdb is bchytrek and he does not have a password, he
        is in the users-list as superuser, an may cerate dbs.

        So why does the authentication fail?

        Helpless

        Bogdan


        ---------------------------(end of broadcast)---------------------------
        TIP 7: don't forget to increase your free space map settings




        ---------------------------(end of broadcast)---------------------------
        TIP 3: if posting/reading through Usenet, please send an appropriate
        subscribe-nomail command to majordomo@postg resql.org so that your
        message can get through to the mailing list cleanly

        Comment

        • Chris Travers

          #5
          Re: authentication failed

          Hi Bogdan;

          This is a typical problem when you install PosgreSQL via the Red Hat CD's.

          You need to edit the pg_hba.conf and change the authentication type to more
          appropriate settings. If your PHP app connects using a host field in the
          connection string, it will be using a network socket. Otherwise, it will be
          a local socket.

          I usually set my servers to use md5 authentication for all network
          connections and trust for local connections, allowing the admin to connect
          locally as any user, but this assumes a level of security and architecture
          you may not wish to assume. md5 authentication on both local and network
          sockets will force password authentication for all connections via a
          zero-knowledge md5-sum authentication method.

          Best Wishes,
          Chris Travers

          ----- Original Message -----
          From: "Bogdan Chytrek" <roboccc@t-online.de>
          To: <pgsql-general@postgre sql.org>
          Sent: Thursday, December 18, 2003 6:26 PM
          Subject: [GENERAL] authentication failed


          Why happens this?

          Warning: pg_connect() unable to connect to PostgreSQL server: FATAL:
          IDENT authentication failed for user "bchytrek" in
          /var/www/html/physio2/test.php on line 19

          The php-statement is :

          $conn = pg_connect("dbn ame=testdb user=bchytrek") ;

          the owner of that testdb is bchytrek and he does not have a password, he
          is in the users-list as superuser, an may cerate dbs.

          So why does the authentication fail?

          Helpless

          Bogdan


          ---------------------------(end of broadcast)---------------------------
          TIP 7: don't forget to increase your free space map settings




          ---------------------------(end of broadcast)---------------------------
          TIP 3: if posting/reading through Usenet, please send an appropriate
          subscribe-nomail command to majordomo@postg resql.org so that your
          message can get through to the mailing list cleanly

          Comment

          Working...