Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubJq6-00Gi2n-7U for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 14:07:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ubJq4-008S7y-90 for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 14:07:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubJq3-008S7q-UI for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 14:07:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubJq1-007cVB-2j for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 14:07:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56EE7KOT609926; Mon, 14 Jul 2025 10:07:20 -0400 From: Tom Lane To: Laurenz Albe cc: Amol Inamdar , pgsql-general@lists.postgresql.org Subject: Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS) In-reply-to: <13e3100fc7c7d14919c37943dcfd76b263cecce2.camel@cybertec.at> References: <13e3100fc7c7d14919c37943dcfd76b263cecce2.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Mon, 14 Jul 2025 14:20:14 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <609924.1752502040.1@sss.pgh.pa.us> Date: Mon, 14 Jul 2025 10:07:20 -0400 Message-ID: <609925.1752502040@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > It is not a good idea to have a mount point be the data directory. ^^^ This. ^^^ That is primarily for safety reasons: if for some reason the filesystem gets dismounted, or hasn't come on-line yet during a reboot, you do not want Postgres to be able to write on the underlying mount-point directory. There is a sobering tale in this old thread: https://www.postgresql.org/message-id/flat/41BFAB7C.5040108%40joeconway.com Now it didn't help any that they were using a start script that would automatically run initdb if it didn't see a data directory where expected. But even without that, you are in for a world of hurt if the mount drops while the server is running and the server has any ability to write on the underlying storage; it will think whatever it was able to write is safely down on disk. To prevent that, the server must not have write permissions on the mount point, which dictates making a separate data directory (with different ownership/permissions) just below the mount. Do not bypass that ownership/permissions check. It is there for very good reasons. regards, tom lane