On Sun, 28 May 2006 20:59:33 -0400
Tom Lane <[EMAIL PROTECTED]> wrote:

> Russell Davie <[EMAIL PROTECTED]> writes:
> > Manually starting postgresql by the user postgres:
> > [EMAIL PROTECTED]:/etc/init.d$ ./postgresql-7.4 start
> > chmod: changing permissions of `/var/run/postgresql': Operation not 
> > permitted
> >  * Starting PostgreSQL 7.4 database server:main
> > Error: Could not change user id                  [fail]
> 
> There is no such error message anywhere in the PG 7.4 source code.
> I suppose it's coming out of whatever init script you're using;
> have you tried reading the init script for enlightenment?
> 

Interesting! I never thought it could be the window manager. 
This is still occurring using Metacity and it still happened in Enlightnement 
and WindowMaker and also at CLI without any window-manager at all!

> (FWIW, init scripts are almost always designed to be executed as
> root, not as random unprivileged users like postgres.  sudo might
> help.)
>
>                       regards, tom lane

postgresql doesn't like been stared as root:
f
[EMAIL PROTECTED]:/etc/init.d$ sudo ./postgresql-7.4 start
Password:
 * Starting PostgreSQL 7.4 database server:main
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will own the 
server process.
The PostgreSQL server failed to start. Please check the log output:             
            [fail]

On doing a search on the disk using the terms: "Could not change user id" 
located this in in line 467 of /usr/share/postgresql-common/PgCommon.pm

It seems this is checking the group and user of the process which suggests not 
getting settings correct.

Maybe this could help in showing where to correct this issue?

[CODE]
# Change effective and real user and group id. If the user id is member of the
# "shadow" group, then "shadow" will be in the set of effective groups. Exits
# with an error message if user/group ID cannot be changed.
# Arguments: <user id> <group id>
sub change_ugid {
    my ($uid, $gid) = @_;
    my $groups = $gid;
    $groups .= " $groups"; # first additional group

    # check whether owner is in the shadow group, and keep shadow privileges in
    # this case; this is a poor workaround for the lack of initgroups().
    my @shadowmembers = split /\s+/, ((getgrnam 'shadow')[3]);
    for my $m (@shadowmembers) {
        my $mid = getpwnam $m;
        if ($mid == $uid) {
            $groups .= ' ' . (getgrnam 'shadow');
            last;
        }
    }

    $( = $) = $groups;
    $< = $> = $uid;
    error 'Could not change user id' if $< != $uid;
    error 'Could not change group id' if $( != $gid;
}
[/CODE]


regards

Russell

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to