Hi,
On Fri, 2018-03-16 at 08:29 +0100, alertas wrote:
> I don't understand, in the official documentation appear "initdb must be
> run as the user that will own the server process, because the server
> needs to have access to the files and directories that initdb creates.
> *Since the server cannot be run as root, you must not run initdb as root
> either*. (It will in fact refuse to do so.)"
As I wrote in my previous post:
The "initdb" that the documentation mentions is:
/usr/pgsql-10/bin/initdb
which must be run by non-root user.
Then, there is a setup script:
/usr/pgsql-10/bin/postgresql-10-setup
which is a wrapper around initdb (and some other things), and the related lines
are:
# Initialize the database
initdbcmd="$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'"
initdbcmd+=" $PGSETUP_INITDB_OPTIONS"
$SU -l postgres -c "$initdbcmd" >> "$PGLOG" 2>&1 < /dev/null
So, when user runs
/usr/pgsql-10/bin/postgresql-10-setup initdb
the word "initdb" is a *parameter* to the script, and as written in the
documentation, we run initdb as the postgres user.
-HTH
Regards,
--
Devrim Gündüz
EnterpriseDB: https://www.enterprisedb.com
PostgreSQL Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR