Re: postgres db deleted and recreated... "No directory, logging in with HOME=/" error... - Mailing list pgsql-novice

From David
Subject Re: postgres db deleted and recreated... "No directory, logging in with HOME=/" error...
Date
Msg-id 20060506215847.GB1333@localhost.localdomain
Whole thread Raw
In response to Re: postgres db deleted and recreated... "No directory, logging in with HOME=/" error...  (<operationsengineer1@yahoo.com>)
Responses Re: postgres db deleted and recreated... "No directory, logging in with HOME=/" error...
List pgsql-novice
On Sat, May 06, 2006 at 12:26:14PM -0700, operationsengineer1@yahoo.com wrote:
> > On Sat, 6 May 2006 10:11:55 -0700 (PDT)
> > <operationsengineer1@yahoo.com> wrote:
> >
> > > well, i dropped the "postgres" db in order to
> > create a
> > > "rails" db.  i tried to do some stuff and i kept
> > > getting the error that postgres didn't exist.
> > then i
> > > remembered that was likely because it was the
> > default
> > > db required to work with other dbs.
> > >
> > > ooops!

> > > anyway, i recreated postgres, but when i "su -
> > > postgres"... i get the following error:
> > >
> > > No directory, logging in with HOME=/
> > >
> > > i think i must've deleted a directory when i
> > deleted
> > > postgres and it wasn't recreated when i recreated
> > > postgres.

FWIW, here's the postgres entry in my /etc/passwd file

postgres:x:31:32:postgres:/var/lib/postgres:/bin/sh

The user ID of 31 indicates that he's entered as a system user.
His home directory is /var/lib/postgres
His login shell is sh, but that probably isn't important.

Umm.. did you delete the _Linux user_ postgres or just the postgres
database?

> yes, this helped a lot.  however, i'm getting an error
> message...
>
> user@7[/]$ psql -U postgres
> psql: FATAL:  Ident authentication failed for user
> "postgres"
> user@7[/]$ su root
> Password:
> root@7[/]# psql -U postgres
> psql: FATAL:  Ident authentication failed for user
> "postgres"

This is because you're using ident authentication for user postgres.  I
don't think you can use this option with ident authentication, because
ident authentication checks to see if you're who you say you are, and as
above, it doesn't see you as being postgres, but as root.  As I noted in
my previous reply, my postgres user authenticates (locally) by this
method.  You will have to su to root and then su to postgres, or
directly with a command like

su -c 'su postgres'

Then, when you're done acting as postgres, you can type exit at the
command prompt and revert straight back to the user you were.

Alternatively, if all you want to do is execute one command as postgres,
you can do as I suggested in my other post.

> where to go from here?
>
> tia...
>
> ps - i'm getting close, i can smell it!  thanks for
> being patient.

Sure, it just takes some getting used to.

pgsql-novice by date:

Previous
From: David
Date:
Subject: Re: Switch to Linux Dev Questions
Next
From: "Stefan Lidman"
Date:
Subject: Re: Switch to Linux Dev Questions