screwed up authentication

Started by john.tigeralmost 12 years ago3 messagesgeneral
Jump to latest
#1john.tiger
john.tigernassau@gmail.com

debian jessie 9.3 latest upgrade

su - postgres
password: xxxxx
==> Authentication failure

edited pg_hba.conf ==> local all all trust
restarted

still failure

sudo -u postgres
pgsql
===> access

okay, figure this is a problem with postgresql user vs linux user - but
how to fix ? is it easier to remove and reinstall postgres ?? or
maybe it is not worth bothering to fix and just use sudo ?

other created users and databases are okay and work from node scripts

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2John R Pierce
pierce@hogranch.com
In reply to: john.tiger (#1)
Re: screwed up authentication

On 6/5/2014 12:24 PM, john.tiger wrote:

debian jessie 9.3 latest upgrade

su - postgres
password: xxxxx
==> Authentication failure

thats the operating system user. to set it, try...

sudo passwd postgres

or, just use sudo as you did later.

edited pg_hba.conf ==> local all all trust
restarted

trust is not recommended, even on a development system. I'd reset
that to 'peer'. my standard pg_hba.conf looks like...

local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
host all all 192.168.0.0/24 md5 # my local subnet

Then, the other thing I do, is...

sudo -u postgres
psql
create user myname password 'something' createdb createuser;
create database myname owner myname;
^D
^D

where myname is my normal unix user account.... this way, you can run
psql as myname and have the privs to create more databases and users for
applications. the database 'myname' is a convenience for that user to
log in with defaults, and is handy to use as a scratchpad for trying out
SQL stuffs. I create other databases for applications.

if you DO want to log on as another role from an arbitrary account,
specify -h localhost, like...

psql -h localhost somedb someuser

still failure

sudo -u postgres
pgsql
===> access

okay, figure this is a problem with postgresql user vs linux user -
but how to fix ? is it easier to remove and reinstall postgres ??
or maybe it is not worth bothering to fix and just use sudo ?

removing/reinstalling would change nothing.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Ray Stell
stellr@vt.edu
In reply to: john.tiger (#1)
Re: screwed up authentication

On Jun 5, 2014, at 3:24 PM, "john.tiger" <john.tigernassau@gmail.com> wrote:

okay, figure this is a problem with postgresql user vs linux user - but how to fix ?

John,
su and sudo are OS commands and the examples you provide using them demonstrate attempts to start a shell as the postgres, OS user. pg_hba.conf is used to control access to the db, which you are not doing with those commands. You have not demonstrated how you are trying to get access to the db. The psql command is commonly used for that purpose and pg_hba.conf would come into play in that case.

http://www.postgresql.org/docs/9.3/interactive/tutorial-accessdb.html

Regards,
Ray