Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Evrytime i run, su - postgres it asks me for a password which I did not set. I simply installed the postgres. I have gone to the pg_hba.conf.

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


# "local" is for Unix domain socket connections only
local   all         all                               ident
# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

I changed the postgres method from ident to trust and then ran sudo /etc/init.d/postgresql restart. Even then it continues to ask for password. i am not sure where am I going wrong?

What should I do?

share|improve this question
The password prompt when running su is done by the operating system not by Postgres. – a_horse_with_no_name Jun 21 '12 at 21:29
so is the password of the operating system?? – Sam007 Jun 21 '12 at 21:31
It is the password of the postgres user in the OS. if you're a sudoer, you can sudo su - postgres. If you're not a sudoer then you probably shouldn't be attempting this anyway. Also, you should revert the changes that you made in you pg_hba.conf file. – swasheck Jun 21 '12 at 21:33
ya i am sudoer and i wish to remove that password of the postgres, for which i changed the method from ident to trust – Sam007 Jun 21 '12 at 21:40
up vote 3 down vote accepted

I was finally able to solve the issue thanks to this site,

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.