pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How do the Linux distributions create the Linux user/group "postgres"?
7+ messages / 5 participants
[nested] [flat]

* How do the Linux distributions create the Linux user/group "postgres"?
@ 2023-01-09 12:41 Matthias Apitz <guru@unixarea.de>
  2023-01-09 13:11 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Thomas Guyot <tguyot@gmail.com>
  2023-01-09 13:15 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Joe Conway <mail@joeconway.com>
  2023-01-09 13:18 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Erik Wienhold <ewie@ewie.name>
  0 siblings, 3 replies; 7+ messages in thread

From: Matthias Apitz @ 2023-01-09 12:41 UTC (permalink / raw)
  To: pgsql-general


Hello,

Please note: I'm talking about the user and group "postgres" in the
Linux OS and not in the PostgreSQL server.

We're compiling PostgreSQL from source (actually 14.1) and distribute that
to our customers. They're asked to setup user and group "postgres"
before creating the cluster. As nowadays there are a lot of setup such
things in bigger installations, like LDAP or AD, etc. I'd like to know
how other installations for Linux deal with this?

Thanks

	matthias

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
@ 2023-01-09 13:11 ` Thomas Guyot <tguyot@gmail.com>
  2 siblings, 0 replies; 7+ messages in thread

From: Thomas Guyot @ 2023-01-09 13:11 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; pgsql-general

On 2023-01-09 07:41, Matthias Apitz wrote:
> Hello,
>
> Please note: I'm talking about the user and group "postgres" in the
> Linux OS and not in the PostgreSQL server.
>
> We're compiling PostgreSQL from source (actually 14.1) and distribute that
> to our customers. They're asked to setup user and group "postgres"
> before creating the cluster. As nowadays there are a lot of setup such
> things in bigger installations, like LDAP or AD, etc. I'd like to know
> how other installations for Linux deal with this?

Hi Matthias,

Users are generally created by the pre-install or post-install scripts 
of the package. The specific ways in which they are created may depend 
on the packaging tool being used and packager that built the 
distribution package.

Regards,

--
Thomas





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
@ 2023-01-09 13:15 ` Joe Conway <mail@joeconway.com>
  2023-01-09 13:27   ` Re: How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
  2023-01-09 14:11   ` Re: How do the Linux distributions create the Linux user/group "postgres"? Ron <ronljohnsonjr@gmail.com>
  2 siblings, 2 replies; 7+ messages in thread

From: Joe Conway @ 2023-01-09 13:15 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; pgsql-general

On 1/9/23 07:41, Matthias Apitz wrote:
> Please note: I'm talking about the user and group "postgres" in the
> Linux OS and not in the PostgreSQL server.
> 
> We're compiling PostgreSQL from source (actually 14.1) and distribute that
> to our customers. They're asked to setup user and group "postgres"
> before creating the cluster. As nowadays there are a lot of setup such
> things in bigger installations, like LDAP or AD, etc. I'd like to know
> how other installations for Linux deal with this?

See for example the PGDG RPM spec file:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-15/ma...

8<-------------------
%pre server
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
	-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
8<-------------------

HTH,

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
  2023-01-09 13:15 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Joe Conway <mail@joeconway.com>
@ 2023-01-09 13:27   ` Matthias Apitz <guru@unixarea.de>
  1 sibling, 0 replies; 7+ messages in thread

From: Matthias Apitz @ 2023-01-09 13:27 UTC (permalink / raw)
  To: Joe Conway <mail@joeconway.com>; +Cc: pgsql-general

El día Montag, Januar 09, 2023 a las 08:15:33 -0500, Joe Conway escribió:

> On 1/9/23 07:41, Matthias Apitz wrote:
> > Please note: I'm talking about the user and group "postgres" in the
> > Linux OS and not in the PostgreSQL server.
> > 
> > We're compiling PostgreSQL from source (actually 14.1) and distribute that
> > to our customers. They're asked to setup user and group "postgres"
> > before creating the cluster. As nowadays there are a lot of setup such
> > things in bigger installations, like LDAP or AD, etc. I'd like to know
> > how other installations for Linux deal with this?
> 
> See for example the PGDG RPM spec file:
> 
> https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-15/ma...
> 
> 8<-------------------
> %pre server
> groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
> useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
> 	-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
> 8<-------------------



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
  2023-01-09 13:15 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Joe Conway <mail@joeconway.com>
@ 2023-01-09 14:11   ` Ron <ronljohnsonjr@gmail.com>
  2023-01-09 15:57     ` Re: How do the Linux distributions create the Linux user/group "postgres"? Joe Conway <mail@joeconway.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Ron @ 2023-01-09 14:11 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 1/9/23 07:15, Joe Conway wrote:
> On 1/9/23 07:41, Matthias Apitz wrote:
>> Please note: I'm talking about the user and group "postgres" in the
>> Linux OS and not in the PostgreSQL server.
>>
>> We're compiling PostgreSQL from source (actually 14.1) and distribute that
>> to our customers. They're asked to setup user and group "postgres"
>> before creating the cluster. As nowadays there are a lot of setup such
>> things in bigger installations, like LDAP or AD, etc. I'd like to know
>> how other installations for Linux deal with this?
>
> See for example the PGDG RPM spec file:
>
> https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-15/ma... 
>
>
> 8<-------------------
> %pre server
> groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
> useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
>     -c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
> 8<-------------------

What if (for example in an already-installed package) uid and gid 26 already 
exist?

-- 
Born in Arizona, moved to Babylonia.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
  2023-01-09 13:15 ` Re: How do the Linux distributions create the Linux user/group "postgres"? Joe Conway <mail@joeconway.com>
  2023-01-09 14:11   ` Re: How do the Linux distributions create the Linux user/group "postgres"? Ron <ronljohnsonjr@gmail.com>
@ 2023-01-09 15:57     ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Joe Conway @ 2023-01-09 15:57 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org

On 1/9/23 09:11, Ron wrote:
> On 1/9/23 07:15, Joe Conway wrote:
>> On 1/9/23 07:41, Matthias Apitz wrote:
>>> Please note: I'm talking about the user and group "postgres" in the
>>> Linux OS and not in the PostgreSQL server.
>>>
>>> We're compiling PostgreSQL from source (actually 14.1) and distribute that
>>> to our customers. They're asked to setup user and group "postgres"
>>> before creating the cluster. As nowadays there are a lot of setup such
>>> things in bigger installations, like LDAP or AD, etc. I'd like to know
>>> how other installations for Linux deal with this?
>>
>> See for example the PGDG RPM spec file:
>>
>> https://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/main/non-common/postgresql-15/ma... 
>>
>>
>> 8<-------------------
>> %pre server
>> groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
>> useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
>>     -c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
>> 8<-------------------
> 
> What if (for example in an already-installed package) uid and gid 26 already
> exist?

The "|| :" at the end of those lines is essentially "or true" -- i.e. if 
the first command fails *due to preexisting uid/gid, the line still 
evaluates as successful. Whether that is a good thing or not is in the 
eye of the beholder I guess.

I have thought about, and played with a bit, the idea of making the 
uid/gid in the community spec file a variable so that it could be passed 
in at rpmbuild time. But that quickly bloomed into a host of related 
issues -- e.g. the default "/var/lib/pgsql" for the home dir, the 
default "postgres" for the user/group names, and/or what to do if the 
username does not exist but the directory does, etc -- I ran out of 
energy to chase it all down.

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: How do the Linux distributions create the Linux user/group "postgres"?
  2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
@ 2023-01-09 13:18 ` Erik Wienhold <ewie@ewie.name>
  2 siblings, 0 replies; 7+ messages in thread

From: Erik Wienhold @ 2023-01-09 13:18 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; pgsql-general

> On 09/01/2023 13:41 CET Matthias Apitz <guru@unixarea.de> wrote:
>
> Hello,
>
> Please note: I'm talking about the user and group "postgres" in the
> Linux OS and not in the PostgreSQL server.
>
> We're compiling PostgreSQL from source (actually 14.1) and distribute that
> to our customers. They're asked to setup user and group "postgres"
> before creating the cluster. As nowadays there are a lot of setup such
> things in bigger installations, like LDAP or AD, etc. I'd like to know
> how other installations for Linux deal with this?

Arch Linux uses sysusers.d[1] to create user postgres[2][3].

[1] https://man.archlinux.org/man/sysusers.d.5
[2] https://github.com/archlinux/svntogit-packages/blob/packages/postgresql/trunk/PKGBUILD#L204
[3] https://github.com/archlinux/svntogit-packages/blob/packages/postgresql/trunk/postgresql.sysusers

--
Erik





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2023-01-09 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 12:41 How do the Linux distributions create the Linux user/group "postgres"? Matthias Apitz <guru@unixarea.de>
2023-01-09 13:11 ` Thomas Guyot <tguyot@gmail.com>
2023-01-09 13:15 ` Joe Conway <mail@joeconway.com>
2023-01-09 13:27   ` Matthias Apitz <guru@unixarea.de>
2023-01-09 14:11   ` Ron <ronljohnsonjr@gmail.com>
2023-01-09 15:57     ` Joe Conway <mail@joeconway.com>
2023-01-09 13:18 ` Erik Wienhold <ewie@ewie.name>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox