Re: screwed up authentication - Mailing list pgsql-general

From John R Pierce
Subject Re: screwed up authentication
Date
Msg-id 5390CA2E.1030505@hogranch.com
Whole thread Raw
In response to screwed up authentication  ("john.tiger" <john.tigernassau@gmail.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: "john.tiger"
Date:
Subject: screwed up authentication
Next
From: Ray Stell
Date:
Subject: Re: screwed up authentication