Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:18:30+00:00 2026-06-09T17:18:30+00:00

After I installed PostgreSQL 9.1 on Ubuntu 12.04 I set the password for the

  • 0

After I installed PostgreSQL 9.1 on Ubuntu 12.04 I set the password for the “postgres” superuser account. I want all users to have to enter their password when loging in. This is why I configured pg_hba.conf like so:

#Database administrative login by Unix domain socket
local   all             postgres                                md5

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5

I restarted postgresql after making those changes. When I do this psql -U testuser I get asked for a password, but when I log in with the “postgres” account like so psql -U postgres I get no password prompt and am logged in.
If I force the password prompt with psql -U postgres -W I can log in by typing the correct password or by typing nothing at all. Typing a wrong password gets rejected.

Can anybody please explain to me why this is happening?

On a related note: I see a lot of example where people use ident as authentication method for the “postgres” user, arguing that to become the “postgres” user one needs the root password of the machine. I assume that the reasoning is that if an attacker gets root access, your done anyways. I would prefer to log in with a password though, one which is not the same as the root password. I prefere having different passwords for different things. Is this reasonable?

Output of grep '^[^#]' pg_hba.conf

local   all             postgres                                md5
local   all             all                                     md5
host    all             all             127.0.0.1/32            md5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:18:31+00:00Added an answer on June 9, 2026 at 5:18 pm

    Your pg_hba.conf should indeed require a password for unix socket connections, but there are still ways around it that you should verify:

    1. a .pgpass file in the postgres home directory containing the password (also check the PGPASSFILE environment variable for a non-standard path).

    2. the PGPASSWORD environment variable could be set.

    And there’s also the possibility that you’re editing the wrong pg_hba.conf file.
    When connected as postgres, the correct path can be obtained for verification with the SHOW hba_file SQL command.

    Also, you may want to check the log file, /var/log/postgresql/postgresql-9.1-main.log for confirmation that the configuration files are reloaded when you ask for it, and look for any suspect message during the authentication.

    As for the reason why passwordless connections with the postgres user are common, the debian PG-9.1 pg_hba.conf has this comment about disallowing them:

    # DO NOT DISABLE!  
    # If you change this first entry you will need to make sure that the  
    # database superuser can access the database using some other method.  
    # Noninteractive access to all databases is required during automatic  
    # maintenance (custom daily cronjobs, replication, and similar tasks).  
    #  
    # Database administrative login by Unix domain socket  
    local   all             postgres                                peer  
    

    Since Debian and Ubuntu use the same postgres packages, this applies to Ubuntu as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fresh ubuntu 10.10 install with all updates and postgresql 8.4 In
I have a Postgresql installed via Homebrew and after a crash I can not
I have installed PostgreSQL 9.1 server on my production server. I have Changed all
I have installed Windows XP after using nlite to remove certain unneeded components. I
After I installed new Eclipse Indigo , it asks me for password every action
I have installed Eclipse on Debian Lenny after having installed java (apt-get install sun-java6-jre
I have installed PostgreSQL to my Mac OS X (10.6), specifically the EnterpriseDB .
I'm using Ubuntu 10.10, PostgreSQL 9.0 and PostGIS 1.5. I've installed PostGIS 1.5 from:
After installed VS10x Code Map I found it created .vs10x files for all my
After I installed the tlsmail gem for email delivery to my gmail account, these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.