Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#63573 - [postgresql] /var/lib/postgres should be owned by user postgres and not by root

Attached to Project: Arch Linux
Opened by Riri (chicha) - Tuesday, 27 August 2019, 16:14 GMT
Last edited by freswa (frederik) - Saturday, 22 February 2020, 20:39 GMT
Task Type Bug Report
Category Packages: Extra
Status Assigned
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



The postgresql package installs a directory '/var/lib/postgres/data' using a dedicated systemd-tmpfiles configuration file with the following settings :

d /var/lib/postgres/data 700 postgres postgres
h /var/lib/postgres/data - - - - +C

systemd-tmpfile will set ownership to postgres only for the innermost directory '/var/lib/postgres/data' but the parent directory will be owned by root.
This is an issue because '/var/lib/postgres' is also the HOME directory for user 'postgres' : such user cannot write psql or bash history files, vim swap files and so ...

I believe the file postgresql.tmpfiles from the package should be changed to :

d /var/lib/postgres 700 postgres postgres
d /var/lib/postgres/data 700 postgres postgres
h /var/lib/postgres/data - - - - +C

Additional info:
* package version(s): postgresql-11.5-1
This task depends upon

Comment by Levente Polyak (anthraxx) - Tuesday, 27 August 2019, 20:49 GMT
while itself true, the postgres user should actually not write any psql or bash history and vim swap files laying around in /var/lib/postgres

imo it shouldn't even be a user with an interactive shell to login with, but in average people don't quite seem to be able to handle psql usage with the postgres user without interactive shell
Comment by kkl2401 (kkl2401) - Thursday, 29 August 2019, 16:14 GMT
It's also worth noting that even the PostgreSQL wiki page ( references using postgres's shell interactively quite a lot. From that it can be assumed people will be doing that.