Re: Doubt with role creation

Lists: pgsql-novice
From: Manuel Rivero <trikitrok(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Doubt with role creation
Date: 2010-10-18 09:24:53
Message-ID: AANLkTint=YDNb7GCY=43rT9dBsNuT_=Y4ewiDchU-Pyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi

I'm trying to create a new role doing:
# CREATE ROLE db_admin WITH CREATEDB CREATEROLE CREATEUSER PASSWORD
'password';
CREATE ROLE

If I check the roles, the new one is there:
postgres=# Select rolname from pg_roles where rolname = 'db_admin';
rolname
---------------
pele_db_admin
(1 fila)

The problem is that when I try to enter psql with this user I get the
following:

postgres(at)linux> psql -U pele_db_admin -W
Password for user pele_db_admin:
psql: FATAL: la autentificación Ident falló para el usuario «pele_db_admin»

which translated is: psql: FATAL: Ident authentication failed for user
«pele_db_admin»

Why is this happening and how could I avoid it?

May be users and roles are not the same and I must create a user called
pele_db_admin?

Thanks in advance.

Best regards,
M


From: Thom Brown <thom(at)linux(dot)com>
To: Manuel Rivero <trikitrok(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Doubt with role creation
Date: 2010-10-18 09:38:23
Message-ID: AANLkTinKpDov3gXmn-TXiCNEHOestvb6EqSznM1s0NVU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On 18 October 2010 10:24, Manuel Rivero <trikitrok(at)gmail(dot)com> wrote:
> Hi
>
> I'm trying  to create a new role doing:
> # CREATE ROLE db_admin WITH CREATEDB CREATEROLE CREATEUSER PASSWORD
> 'password';
> CREATE ROLE
>
> If I check the roles, the new one is there:
> postgres=# Select rolname from pg_roles where rolname = 'db_admin';
> rolname
> ---------------
> pele_db_admin
> (1 fila)
>
> The problem is that when I try to enter psql with this user I get the
> following:
>
> postgres(at)linux> psql -U pele_db_admin -W
> Password for user pele_db_admin:
> psql: FATAL:  la autentificación Ident falló para el usuario «pele_db_admin»
>
> which translated is: psql: FATAL:  Ident authentication failed for user
> «pele_db_admin»
>
> Why is this happening and how could I avoid it?
>
> May be users and roles are not the same and I must create a user called
> pele_db_admin?

An "ident" authentication failure is down to your pg_hba.conf file
configuration. It means it's probably trying to match the user you're
running psql as with the user credentials you're trying to log in
with. Rather than use ident, you'll either want trust (which will not
require a password and I don't recommend), or md5. You may wish to
post the records from pg_hba.conf here if you still can't get it
working.

Regards

Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935


From: Thom Brown <thom(at)linux(dot)com>
To: Manuel Rivero <trikitrok(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Doubt with role creation
Date: 2010-10-18 14:46:25
Message-ID: AANLkTinsvQEn+O7ktSj=fUHE2beR+iFXH3C0GLBs_fNY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On 18 October 2010 15:39, Manuel Rivero <trikitrok(at)gmail(dot)com> wrote:
> Hi
>
> First of all, thank you very much for your answer..
>
> I followed your advise and changed the pg_hba.conf to use of md5 instead of
> ident.
>
> Now I don't get that error,but I'm afraid I'm getting a different one..
>
> This is what I did after changing pg_hba.conf:
>
> CREATE ROLE db_admin LOGIN PASSWORD 'dbAdmin' CREATEDB CREATEROLE
> NOSUPERUSER;
> CREATE ROLE
> postgres=# \q
>
> Now when I try to to login
> postgres(at)linux-2dqb:> psql -U db_admin -W
> Contraseña para usuario db_admin:
> psql: FATAL:  no existe la base de datos «db_admin»
>
> Traslated:
> psql: FATAL:  the database «db_admin» does not exist
>
> Why is it necessary to have a database for a new user?
>
> I just wanted to have a user different to postgres to work with.

Hi Manuel,

(Please use "Reply to all" when replying as the list should be copied
back in so everyone can see your response. And try to put your
responses below the message you're replying to.)

By default, psql will attempt to connect to a database with the same
name as a user. This obviously isn't what you want in this case, so
you need to specify the database name:

psql -U db_admin -W your_database

So the database name appears as the last parameter, or you can use "-d
your_database" instead if it helps make it clearer.

Regards

Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935


From: Manuel Rivero <trikitrok(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Doubt with role creation
Date: 2010-10-18 14:53:24
Message-ID: AANLkTimqQsOuH7FJY5pFW31TmpCP=BVMyv89hHh54MO_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Mon, Oct 18, 2010 at 4:46 PM, Thom Brown <thom(at)linux(dot)com> wrote:

> On 18 October 2010 15:39, Manuel Rivero <trikitrok(at)gmail(dot)com> wrote:
> > Hi
> >
> > First of all, thank you very much for your answer..
> >
> > I followed your advise and changed the pg_hba.conf to use of md5 instead
> of
> > ident.
> >
> > Now I don't get that error,but I'm afraid I'm getting a different one..
> >
> > This is what I did after changing pg_hba.conf:
> >
> > CREATE ROLE db_admin LOGIN PASSWORD 'dbAdmin' CREATEDB CREATEROLE
> > NOSUPERUSER;
> > CREATE ROLE
> > postgres=# \q
> >
> > Now when I try to to login
> > postgres(at)linux-2dqb:> psql -U db_admin -W
> > Contraseña para usuario db_admin:
> > psql: FATAL: no existe la base de datos «db_admin»
> >
> > Traslated:
> > psql: FATAL: the database «db_admin» does not exist
> >
> > Why is it necessary to have a database for a new user?
> >
> > I just wanted to have a user different to postgres to work with.
>
> Hi Manuel,
>
> (Please use "Reply to all" when replying as the list should be copied
> back in so everyone can see your response. And try to put your
> responses below the message you're replying to.)
>
> By default, psql will attempt to connect to a database with the same
> name as a user. This obviously isn't what you want in this case, so
> you need to specify the database name:
>
> psql -U db_admin -W your_database
>
> So the database name appears as the last parameter, or you can use "-d
> your_database" instead if it helps make it clearer.
>
> Regards
>
> Thom Brown
> Twitter: @darkixion
> IRC (freenode): dark_ixion
> Registered Linux user: #516935
>

Hi

It's working now. Thank you very much!

Regards,
M