From: | Russell Davie <rjrd(at)exemail(dot)com(dot)au> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Error: Could not change user id |
Date: | 2006-05-29 04:25:15 |
Message-ID: | 20060529142515.2da47049@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Sun, 28 May 2006 20:59:33 -0400
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Russell Davie <rjrd(at)exemail(dot)com(dot)au> writes:
> > Manually starting postgresql by the user postgres:
> > postgres(at)XXXX:/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
XX(at)XXXX:/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
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Allen | 2006-05-29 04:57:15 | Re: Error: Could not change user id |
Previous Message | Tom Lane | 2006-05-29 00:59:33 | Re: Error: Could not change user id |