Thread: Postgres User and Password

Postgres User and Password

From
R Talbot
Date:
I was not able to get an RPM build for Calder Edesktop 2.3 & 2.4..
So, I downloaded source for Postgres v 7.0.3 and rolled my own..
I compiled the source to 3 linux boxes and Installed to 3 OS/2 boxes.

My problem is with my Linux Posgres installations.
I compiled as root and installed as root user. As root I can
root@thinkpad root]#  su postgres
root@thinkpad root]#  pg_ctl  start  ...........  Or use postmaster

and successfully start the server.. As I have set all Path and Data
enviormental variables.
But, if I try this as a user
Bob@thinkpad Bob]# su postgres ............. My results is
 password:                                          ............ Then no
matter whats entered, even NULL

........... I get
su: incorrect password

I had no password for User postgres but I finally gave it one but no
help..
I made root and Bob both members of  Group database..     no help.
Once server is started Bob is a postgres user and can start and use
psql...

Very inconvenient to log in as root then su postgres then back to User
login to
development tools..
How can I fix this problem..

Thank You
Bob T


Re: Postgres User and Password

From
GH
Date:
On Fri, Jul 13, 2001 at 09:43:57PM -0400, some SMTP stream spewed forth:
[...]
> My problem is with my Linux Posgres installations.
> I compiled as root and installed as root user. As root I can
> root@thinkpad root]#  su postgres
> root@thinkpad root]#  pg_ctl  start  ...........  Or use postmaster
>
> and successfully start the server.. As I have set all Path and Data
> enviormental variables.

> But, if I try this as a user
> Bob@thinkpad Bob]# su postgres ............. My results is
>  password:                                          ............ Then no
> matter whats entered, even NULL

Did you expect anything different?
Trying to su from an unprivileged user to any user with no password
should fail miserably.

You must be root to su to a user with no passwd, e.g.
root% su postgres
postgres#

> ........... I get
> su: incorrect password
>
> I had no password for User postgres but I finally gave it one but no
> help..

That indicates a greater problem with your system. Try resetting it
so postgres has no password, and try su'ing as root.

> I made root and Bob both members of  Group database..     no help.
That should be irrelevant.

> Once server is started Bob is a postgres user and can start and use
> psql...

This is not related.

> Very inconvenient to log in as root then su postgres then back to User
> login to
> development tools..

I have no idea why you would do that.

> How can I fix this problem..

You can have the server start automatically upon boot.
Beyond that, you have no need to 'su postgres'. You can use psql as any
user on the machine (provided the permissions are all set correctly).
Can you be more specific about what the 'problem' is?

> Thank You
> Bob T

gh
--
> What, no one sings along with Ricky Martin anymore?
My kid sister does (but then, she prefers pico to vi ...)
    -- Suresh Ramasubramanian, alt.sysadmin.recovery

Re: Postgres User and Password

From
A_Schnabel@t-online.de (Andre Schnabel)
Date:
Hi,

to me it doesn't like a problem of Postgres.
My first guess is, you typed the password wrong. So try another password for
postgres.

But maybe, it's a misconfiguration of your linux box.
Try logging in as root, then su to postgres (without passwordprompt) an then
su to bob.
You should be askef for bob's password. If su to bob fails with the same
error (invalid password) although you typed the right one, it's a problem of
your linux system.

CU,
Andre

----- Original Message -----
From: R Talbot
To: pgsql-general@postgresql.org
Sent: Saturday, July 14, 2001 3:43 AM
Subject: [GENERAL] Postgres User and Password


I was not able to get an RPM build for Calder Edesktop 2.3 & 2.4..
So, I downloaded source for Postgres v 7.0.3 and rolled my own..
I compiled the source to 3 linux boxes and Installed to 3 OS/2 boxes.

My problem is with my Linux Posgres installations.
I compiled as root and installed as root user. As root I can
root@thinkpad root]#  su postgres
root@thinkpad root]#  pg_ctl  start  ...........  Or use postmaster

and successfully start the server.. As I have set all Path and Data
enviormental variables.
But, if I try this as a user
Bob@thinkpad Bob]# su postgres ............. My results is
 password:                                          ............ Then no
matter whats entered, even NULL

........... I get
su: incorrect password

I had no password for User postgres but I finally gave it one but no
help..
I made root and Bob both members of  Group database..     no help.
Once server is started Bob is a postgres user and can start and use
psql...

Very inconvenient to log in as root then su postgres then back to User
login to
development tools..
How can I fix this problem..

Thank You
Bob T


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Re: Postgres User and Password

From
markMLl.pgsql-general@telemetry.co.uk
Date:
Andre Schnabel wrote:
>
> to me it doesn't like a problem of Postgres.
> My first guess is, you typed the password wrong. So try another password for
> postgres.

One thing I would say is that I find pg very particular as regards case.
I now keep all user, table etc. names lower-case (even if the
corresponding "real" user name includes caps). The impression I get is
that the server is flattening user names to lower case.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or
colleagues]

Re: Postgres User and Password

From
Justin Clift
Date:
Hi Bob,

This sounds more like a general Unix security problems than anything
PostgreSQL specific.

If you are only changing to the "postgres" user to start the database
server, then would it be better for your Linux startup scripts to
automatically start PostgreSQL when the server starts, then have your
user accounts setup so they can access PostgreSQL directly?  That way
people should be able to log in as themselves and use PostgreSQL
directly without having to su anywhere?

:-)

Regards and best wishes,

Justin Clift

R Talbot wrote:
>
> I was not able to get an RPM build for Calder Edesktop 2.3 & 2.4..
> So, I downloaded source for Postgres v 7.0.3 and rolled my own..
> I compiled the source to 3 linux boxes and Installed to 3 OS/2 boxes.
>
> My problem is with my Linux Posgres installations.
> I compiled as root and installed as root user. As root I can
> root@thinkpad root]#  su postgres
> root@thinkpad root]#  pg_ctl  start  ...........  Or use postmaster
>
> and successfully start the server.. As I have set all Path and Data
> enviormental variables.
> But, if I try this as a user
> Bob@thinkpad Bob]# su postgres ............. My results is
>  password:                                          ............ Then no
> matter whats entered, even NULL
>
> ........... I get
> su: incorrect password
>
> I had no password for User postgres but I finally gave it one but no
> help..
> I made root and Bob both members of  Group database..     no help.
> Once server is started Bob is a postgres user and can start and use
> psql...
>
> Very inconvenient to log in as root then su postgres then back to User
> login to
> development tools..
> How can I fix this problem..
>
> Thank You
> Bob T
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Re: Postgres User and Password

From
R Talbot
Date:
GH wrote:

> > But, if I try this as a user
> > Bob@thinkpad Bob]# su postgres ............. My results is
> >  password:                                          ............ Then no
> > matter whats entered, even NULL
>
> Did you expect anything different?
> Trying to su from an unprivileged user to any user with no password
> should fail miserably.


But I gave user Postgres a password



>
>
> > ........... I get
> > su: incorrect password
> >
> > I had no password for User postgres but I finally gave it one but no
> > help..
>
> That indicates a greater problem with your system. Try resetting it
> so postgres has no password, and try su'ing as root.
>

    But this problem exists on 3 Postgres src installs on 2 different Linux
  versions where on each I can su from user Bob to all other user with
   their passwords without a hitch.
   The only user that stops me is Postgres?????

> > Very inconvenient to log in as root then su postgres then back to User
> > login to
> > development tools..
>
> I have no idea why you would do that.
>

  You are indicating I should not do what?
     Login as root then su to postgres or
     Log back to user  to use development tools?
        I do not auto start any servers because....
          I am doing comparative development and each
           development machine all 5 have installed
               Sybase...DB2...PostgreSQL..MySQL..
                I don't want all 4 RDBMS running only the
                 current working develpment session.
                So, I manually start Database servers.

>
> You can have the server start automatically upon boot.
> Beyond that, you have no need to 'su postgres'. You can use psql as any
> user on the machine (provided the permissions are all set correctly).
> Can you be more specific about what the 'problem' is?
>

    GH ...See more above.. : )
    Comments :The OS/2 version (compiled by Team Italia) installed
              automatically in 5 minutes, with folders on the desktop V.7.0.2

              and has run perfectly.. As I run caldera 2.3 and 2.4 edesktops,

              the Postgres binary RPM will only work with 2.3 Caldera
               eserver.
            I even called GreatBridge and offered CASH money for help to
               set up for Caldera edesktop. They said, BEYOND our SCOPE.
               Did not give me confidence in their abilities.
             I finally compiled my own from source 3 times with various
           problems. i.e. I use jave so I sought out Apache  ant.jar..
      Not a straight road for my Linux Experience.
       Which is why I am still evaluating  4 RDBMS.
Not to mention  ;^)
     I have tried setting my subcription in General-Postgres to NOMAIL
      for 60 days with no sucess. My mailbox gets up to 500 emails a
      day.
  Postgres has a lot going for it. I like the way it works ( in OS/2).
   but I am first a Linux user.
   Unless my tools work right, I can't get this project off the ground.

>

  Once again thank you very much for your time.. Any further input
is much appreciated.

  Bob T

> > Thank You
> > Bob T
>
>


Re: Postgres User and Password

From
Stephan Szabo
Date:
> > > Very inconvenient to log in as root then su postgres then back to User
> > > login to
> > > development tools..
> >
> > I have no idea why you would do that.
> >
>
>   You are indicating I should not do what?
>      Login as root then su to postgres or
>      Log back to user  to use development tools?
>         I do not auto start any servers because....
>           I am doing comparative development and each
>            development machine all 5 have installed
>                Sybase...DB2...PostgreSQL..MySQL..
>                 I don't want all 4 RDBMS running only the
>                  current working develpment session.
>                 So, I manually start Database servers.

Well, you can install postgres as a user other than postgres.

If you're the only user doing this, that's probably the easiest
thing for you, just install it as your own user, that way you
don't need to su at all.



Re: Postgres User and Password

From
Fabrice Scemama
Date:
The hell with all this funk !
you should :
- su root
- cd /home/postgres/data/  (wherever your postgres is)
- configure at least *once* your pg_hba.conf

First time, you could set it up to trust everyone on your
network. Then, su postgres, modify users' passwords
(system table pg_user from database template1 -- or, any
existing database), then possibly choose to set up your
pg_hba.conf back with the secure options it certainly had
before. Anyway, RTFM.

R Talbot wrote:
>
> GH wrote:
>
> > > But, if I try this as a user
> > > Bob@thinkpad Bob]# su postgres ............. My results is
> > >  password:                                          ............ Then no
> > > matter whats entered, even NULL
> >
> > Did you expect anything different?
> > Trying to su from an unprivileged user to any user with no password
> > should fail miserably.
>
> But I gave user Postgres a password
>
> >
> >
> > > ........... I get
> > > su: incorrect password
> > >
> > > I had no password for User postgres but I finally gave it one but no
> > > help..
> >
> > That indicates a greater problem with your system. Try resetting it
> > so postgres has no password, and try su'ing as root.
> >
>
>     But this problem exists on 3 Postgres src installs on 2 different Linux
>   versions where on each I can su from user Bob to all other user with
>    their passwords without a hitch.
>    The only user that stops me is Postgres?????
>
> > > Very inconvenient to log in as root then su postgres then back to User
> > > login to
> > > development tools..
> >
> > I have no idea why you would do that.
> >
>
>   You are indicating I should not do what?
>      Login as root then su to postgres or
>      Log back to user  to use development tools?
>         I do not auto start any servers because....
>           I am doing comparative development and each
>            development machine all 5 have installed
>                Sybase...DB2...PostgreSQL..MySQL..
>                 I don't want all 4 RDBMS running only the
>                  current working develpment session.
>                 So, I manually start Database servers.
>
> >
> > You can have the server start automatically upon boot.
> > Beyond that, you have no need to 'su postgres'. You can use psql as any
> > user on the machine (provided the permissions are all set correctly).
> > Can you be more specific about what the 'problem' is?
> >
>
>     GH ...See more above.. : )
>     Comments :The OS/2 version (compiled by Team Italia) installed
>               automatically in 5 minutes, with folders on the desktop V.7.0.2
>
>               and has run perfectly.. As I run caldera 2.3 and 2.4 edesktops,
>
>               the Postgres binary RPM will only work with 2.3 Caldera
>                eserver.
>             I even called GreatBridge and offered CASH money for help to
>                set up for Caldera edesktop. They said, BEYOND our SCOPE.
>                Did not give me confidence in their abilities.
>              I finally compiled my own from source 3 times with various
>            problems. i.e. I use jave so I sought out Apache  ant.jar..
>       Not a straight road for my Linux Experience.
>        Which is why I am still evaluating  4 RDBMS.
> Not to mention  ;^)
>      I have tried setting my subcription in General-Postgres to NOMAIL
>       for 60 days with no sucess. My mailbox gets up to 500 emails a
>       day.
>   Postgres has a lot going for it. I like the way it works ( in OS/2).
>    but I am first a Linux user.
>    Unless my tools work right, I can't get this project off the ground.
>
> >
>
>   Once again thank you very much for your time.. Any further input
> is much appreciated.
>
>   Bob T
>
> > > Thank You
> > > Bob T
> >
> >

--
"Le veritable egoiste  est celui qui ne pense qu'a  lui quand il parle
d'un autre." -- Pierre Dac

Attachment

create function .... return record

From
"Chris Mulcahy"
Date:
Greetings:

I am attempting to create a function that returns a record.  I have two
problems, one is that Postgresql does not recognize the return type
record.  How do I set this up?

The second issue I'm having is that I've found plenty of examples to do
a 'select into recReturn * from theTable' but I want to have two select
statements stuffing info into my record.

Maybe I'm not even coming up with the right solution.  I'm trying to
create a function that returns two or more values.  What is the best way
to do that?

Thanks
Chris (relativly new to PgSQL, but not new to SQL)



RE: Postgres User and Password

From
"charlie derr"
Date:
+> Very inconvenient to log in as root then su postgres then back to User
+> login to
+> development tools..
+> How can I fix this problem..
+>
+> Thank You
+> Bob T
+>


As Justin said, this is really a *nix question.  The answer to the specific
problem you're having (i still recommend you follow Justin's advice about
using startup scripts) is:

su
(enter root password)
passwd postgres
(enter pw you wish to use for postgres user)
(enter it again)

voila -- you should now be able to su to the postgres user directly from
your user (without su-ing to root first)

    ~c


Re: Postgres User and Password

From
R Talbot
Date:
charlie derr wrote:

> +> Very inconvenient to log in as root then su postgres then back to User
> +> login to
> +> development tools..
> +> How can I fix this problem..
> +>
> +> Thank You
> +> Bob T
> +>
>
> As Justin said, this is really a *nix question.  The answer to the specific
> problem you're having (i still recommend you follow Justin's advice about
> using startup scripts) is:
>
> su
> (enter root password)
> passwd postgres
> (enter pw you wish to use for postgres user)
> (enter it again)
>
> voila -- you should now be able to su to the postgres user directly from
> your user (without su-ing to root first)
>

Charlie

  I thank you for following up on an old thread.
I had done just that allowing start up as user from Terminal.
As I had explained I am developing with ...
  DB2.. PostgreSQL.. Sybase.. & MySQL..
For this reason I cannot have any RDBMS start at boot.
I must be  able to choose the system of the day.
Once I determine the right RDBMS for the project then
I will have one start at boot.

 My current impass is deciding among other items
ease of backup and PIT recovery and use of WAL logs.
I want to be able to recovery current work with some grace.
I will post this on a seperate thread.

Thanks

Bob T