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 Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:15 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
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

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:15 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/postgresql/issues/1
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 (https://wiki.archlinux.org/index.php/PostgreSQL) references using postgres's shell interactively quite a lot. From that it can be assumed people will be doing that.
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.