Re: How to modify the postgresql source code and build it?

Lists: pgsql-novice
From: Shreesha <shreesha1988(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: How to modify the postgresql source code and build it?
Date: 2014-06-12 23:30:48
Message-ID: CAPBNhTwUxRp+bVKWd_adCre7Dsd38Awj9UxewhG1rpv3q96SWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hello,
I need to initialize the db as the root and start the database server. In
order to accomplish this, I modified the initdb.c source file of pgsql
package and tried to compile it. Eventhough the build was successful, I
couldn't see the root user able to execute initdb executable generated by
the build. I wanted to know if there is any other procedure for building
the postgresql procedure?

Thanks
Shreesha.

P.S
Below is the changes done in initdb.c (shown in bold letters below)
-------------------------------------------------------------------------------------------------------------------------------
static char *
get_id(void)
{
#ifndef WIN32

struct passwd *pw;

// if (geteuid() == 0) /* 0 is root's uid */
*/* {*
* fprintf(stderr,*
* _("%s: cannot be run as root\n"*
* "Please log in (using, e.g., \"su\") as
the "*
* "(unprivileged) user that will\n"*
* "own the server process.\n"),*
* progname);*
* exit(1);*
* }*
**/*
...
}


From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Shreesha *EXTERN*" <shreesha1988(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to modify the postgresql source code and build it?
Date: 2014-06-13 08:36:36
Message-ID: A737B7A37273E048B164557ADEF4A58B17D0272D@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Shreesha wrote:
> I need to initialize the db as the root and start the database server.

There's the problem. You shouldn't do that.
You don't want the database server to run as root.

Yours,
Laurenz Albe