Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default postgres configuration does not "trust" postgres user #3

Closed
rageshkrishna opened this issue Dec 2, 2015 · 0 comments
Closed
Assignees

Comments

@rageshkrishna
Copy link
Contributor

Out of the box, this image does not allow me to run psql commands by using the -U parameter to pass the username. Repro steps and output below:

root@751e37ecfac7:/# sudo service postgresql start
 * Starting PostgreSQL 9.4 database server [ OK ]
root@751e37ecfac7:/# psql -c "create database foo" -U postgres
psql: FATAL:  Peer authentication failed for user "postgres"

Currently, the only way out is to run psql after switching to the postgres user like this:

root@751e37ecfac7:/# sudo su postgres -c 'psql -c "create database foo"'
CREATE DATABASE
root@751e37ecfac7:/#

This works, but it's rather inelegant.

This can be fixed by updating /etc/postgresql/9.4/main/pg_hba.conf to change this line:

local   all             postgres                                peer

to

local   all             postgres                                trust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants