Обсуждение: Incorrect password using pg_ctl

Поиск
Список
Период
Сортировка

Incorrect password using pg_ctl

От
Matthew Stanfield
Дата:
Hi,

I've just reinstalled linux (RedHat 7.2) and PostgreSQL (latest version).

When I use pg_ctl in a line such as:

su -c 'pg_ctl start -l /var/lib/pgsql/logs/serverlog
-D /var/lib/pgsql/data -o -i' postgres

I get an 'incorrect password' error. On further examination I've found that
even if using root privileges I can't successfully change the postgres user
password. Since this user was created by the RPM installation of postgres I
have no idea what the password is. How do I change the user postgres
password?

Sorry if this is as much a linux question as postgresql, I thought someone
here may have had the same problem.

Thanks and regards,

Matthew

Re: Incorrect password using pg_ctl

От
Lamar Owen
Дата:
On Wednesday 17 April 2002 11:46 am, Matthew Stanfield wrote:
> I've just reinstalled linux (RedHat 7.2) and PostgreSQL (latest version).

> When I use pg_ctl in a line such as:

> su -c 'pg_ctl start -l /var/lib/pgsql/logs/serverlog
> -D /var/lib/pgsql/data -o -i' postgres

> I get an 'incorrect password' error. On further examination I've found that
> even if using root privileges I can't successfully change the postgres user
> password. Since this user was created by the RPM installation of postgres I
> have no idea what the password is. How do I change the user postgres
> password?

su
passwd postgres
type in your desired password.

The default RPM installation has an invalid password for postgres -- this is
OK, by the way, as an su from root to postgres still works.  It's used in the
RPM's initscripts -- it does indeed work.  If for some reason an su to
postgres from a root shell does not work, you have other problems.  I've
never run into that before -- su to ANY user from root bypasses password
checking.

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

Re: Incorrect password using pg_ctl

От
Matthew Stanfield
Дата:
Lamar Owen wrote:
>
> On Wednesday 17 April 2002 11:46 am, Matthew Stanfield wrote:
> > I've just reinstalled linux (RedHat 7.2) and PostgreSQL (latest version).
>
> > When I use pg_ctl in a line such as:
>
> > su -c 'pg_ctl start -l /var/lib/pgsql/logs/serverlog
> > -D /var/lib/pgsql/data -o -i' postgres
>
> > I get an 'incorrect password' error. On further examination I've found that
> > even if using root privileges I can't successfully change the postgres user
> > password. Since this user was created by the RPM installation of postgres I
> > have no idea what the password is. How do I change the user postgres
> > password?
>
> su
> passwd postgres
> type in your desired password.
>
> The default RPM installation has an invalid password for postgres -- this is
> OK, by the way, as an su from root to postgres still works.  It's used in the
> RPM's initscripts -- it does indeed work.  If for some reason an su to
> postgres from a root shell does not work, you have other problems.  I've
> never run into that before -- su to ANY user from root bypasses password
> checking.

Thanks Lamar.

If I login as 'su' and then use 'passwd postgres' to change the password it
appears to change the password but I still get 'incorrect password' when I
try to start the database using "su -c 'pg_ctl start...' postgtres"
regardless of whether I type in my postgres user password or my root
password (although I am pretty sure it doesn't want my root password here
anyway). I had tried this before I posted the list with this problem and
have tried the process several times so I am sure it's not a trivial
problem like misspelling my password.

The only way I can now start the postgresql server properly (IE. as user
'postgres') is to log in as root using 'su' and then use 'su postgres'
which then doesn't require me to enter the postgres user password.

What I really want is to be able to start/stop/status the server from my
normal account the way I always used to by using aliases for the long
command lines of "su -c 'pg_ctl start/stop...' postgres".

Any ideas what I should try and do next?

Many thanks and regards,

..matthew

Re: Incorrect password using pg_ctl

От
Doug McNaught
Дата:
Matthew Stanfield <matthew@propertyknowledge.com> writes:

> What I really want is to be able to start/stop/status the server from my
> normal account the way I always used to by using aliases for the long
> command lines of "su -c 'pg_ctl start/stop...' postgres".

Write a little C program that exec's pg_ctl with the appropriate
arguments, make it setuid 'postgres'?

-Doug
--
Doug McNaught       Wireboard Industries      http://www.wireboard.com/

      Custom software development, systems and network consulting.
      Java PostgreSQL Enhydra Python Zope Perl Apache Linux BSD...

Re: Incorrect password using pg_ctl

От
Matthew Stanfield
Дата:
Doug McNaught wrote:
>
> Matthew Stanfield <matthew@propertyknowledge.com> writes:
>
> > What I really want is to be able to start/stop/status the server from my
> > normal account the way I always used to by using aliases for the long
> > command lines of "su -c 'pg_ctl start/stop...' postgres".
>
> Write a little C program that exec's pg_ctl with the appropriate
> arguments, make it setuid 'postgres'?

Thanks Doug.

I could do this but I am intrigued as to why I can't do things the way I
have described (as above), since that was the setup that worked when I had
the same versions of linux and postgresql installed before I had to do a
clean re-install a few days ago.

Regards,

..matthew