/var/lib/pgsql 0755

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Devrim Gündüz <devrim(at)gunduz(dot)org>
Cc: pgsql-pkg-yum(at)postgresql(dot)org
Subject: /var/lib/pgsql 0755
Date: 2021-05-27 18:03:53
Message-ID: 20210527180353.GC2082@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-yum

Hi,

Postgres requires that the data dir is restricted:
2021-05-27 13:39:44.002 EDT [23409] FATAL: data directory "/var/lib/pgsql/pgsql14.jtp" has invalid permissions
2021-05-27 13:39:44.002 EDT [23409] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).

But the server package creates /v/l/pgsql as mode 700, and rpm resets the perms
on every installation.

[pryzbyj(at)database ~]$ rpm -qvl postgresql14-server-14-beta1_3PGDG.rhel7.x86_64 |grep var/lib
drwx------ 2 postgrespostgres 0 May 21 06:18 /var/lib/pgsql
drwx------ 2 postgrespostgres 0 May 21 06:18 /var/lib/pgsql/14
drwx------ 2 postgrespostgres 0 May 21 06:18 /var/lib/pgsql/14/backups
drwx------ 2 postgrespostgres 0 May 21 06:18 /var/lib/pgsql/14/data

That seems unnecessarily restrictive, since I might put something like logs
underneath there, and I'd prefer to be able to look for them, tab complete
them, maybe even look *at* them, depending on log_file_mode, and the
permissions that *I* set on the subdir. I might just want to "ls"/tab complete
to know which version dir to use. In my deployment script, I go to the effort
to set it back to 00755 for convenience.

Maybe the mode 700 stuff is leftover from old packages which didn't include a
version ? Either in the package name or as a subdir.

There's not many base pakages which do this:
rpm -qlav |grep '^drwx.*root *root' |grep -v ^drwxr-xr-x |awk -F/ '!/audit|firewall|tmp|lvm/ && NF<5'

Would you consider setting at least /v/l/p to mode 755? And maybe the version
subdirs (like 14) too.

--
Justin

Responses

Browse pgsql-pkg-yum by date

  From Date Subject
Next Message Justin Pryzby 2021-05-27 18:50:25 Re: /var/lib/pgsql 0755
Previous Message Devrim Gündüz 2021-05-27 14:31:14 Re: SV: gdal30 and Rhel 8.4 dependency problem