Clarification of initdb ownership requirement on Windows

Started by Jc Cipriano13 days ago3 messagesdocs
Jump to latest
#1Jc Cipriano
carlocipriano20@gmail.com

Hello PostgreSQL Documentation Team,

I would like to request clarification regarding the following statement in
the PostgreSQL 18 documentation for initdb:

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.)

I could not find a Windows-specific explanation of what constitutes the
required ownership identity.

Could you clarify which interpretation is intended for Windows?

1.

*Same-account requirement:* The Windows account that executes initdb
must also be the Windows account under which the PostgreSQL server process
subsequently runs.
2.

*Access-based requirement:* The accounts may differ, provided that the
Windows account running the PostgreSQL server has the necessary access to
the initialized data directory and related files.

If the intended behavior differs between Windows and Unix-like platforms,
it would also be helpful to clarify that distinction.

I also found a November 2022 discussion that touched on this paragraph, but
I could not find a definitive resolution of the Windows-specific question.

This question is particularly relevant to Windows installations that
register PostgreSQL as a Windows service using a dedicated service account.

I am not proposing a specific implementation or documentation change at
this stage. I would first like to understand the intended and supported
behavior.

Thank you for your time and for maintaining PostgreSQL documentation.

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Jc Cipriano (#1)
Re: Clarification of initdb ownership requirement on Windows

On Mon, Nov 9, 2026 at 5:48 AM Jc Cipriano <carlocipriano20@gmail.com>
wrote:

Hello PostgreSQL Documentation Team,

I would like to request clarification regarding the following statement in
the PostgreSQL 18 documentation for initdb:

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.)

I could not find a Windows-specific explanation of what constitutes the
required ownership identity.

Aside from the root restriction on Linux there is none. PostgreSQL itself
doesn't make any additional checks of its own. If the operating
environment permits the necessary actions the server will work. The most
expedient way is to ensure whatever runs initdb also executes pg_ctl.

Could you clarify which interpretation is intended for Windows?

1.

*Same-account requirement:* The Windows account that executes initdb
must also be the Windows account under which the PostgreSQL server process
subsequently runs.
2.

*Access-based requirement:* The accounts may differ, provided that the
Windows account running the PostgreSQL server has the necessary access to
the initialized data directory and related files.

Option 2

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jc Cipriano (#1)
Re: Clarification of initdb ownership requirement on Windows

Jc Cipriano <carlocipriano20@gmail.com> writes:

Could you clarify which interpretation is intended for Windows?

1.
*Same-account requirement:* The Windows account that executes initdb
must also be the Windows account under which the PostgreSQL server process
subsequently runs.
2.
*Access-based requirement:* The accounts may differ, provided that the
Windows account running the PostgreSQL server has the necessary access to
the initialized data directory and related files.

I recommend following option 1. Option 2 might accidentally work
today, but it doesn't map to what we expect on Unix-oid systems,
and nobody here is going to shed a tear if we break it.

regards, tom lane