Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIaBC-00007E-7H for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 15:16:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIaBA-0006iC-GM for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 15:16:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIaBA-0006hw-3M for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2019 15:16:36 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iIaB3-0001mk-Dl for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2019 15:16:34 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 375A65F79F; Thu, 10 Oct 2019 11:16:28 -0400 (EDT) Date: Thu, 10 Oct 2019 11:16:28 -0400 From: Stephen Frost To: Timmy Siu Cc: pgsql-general@lists.postgresql.org Subject: Re: Minimum privilege for Backup and replication Message-ID: <20191010151628.GE6962@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ZwycGzhRzgIApymG" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --ZwycGzhRzgIApymG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Timmy Siu (timmy.siu@aol.com) wrote: > Now, my question is - > What is the Minimum Privilege of a pgsql Backup or Replication user? To perform a file-level backup of PostgreSQL, your OS user will need read access to all of the files in the data directory (you can use group privileges for that as of v11, as I recall), and then it'll need to be able to connect to PG as a user and be able to execute the pg_start_backup() and pg_stop_backup() functions (you can grant that access by issuing GRANT commands). Depending on your file-level backup solution (please do NOT roll your own...), you might also need to grant access to functions like pg_switch_wal() too. Check the documentation for the backup solution. We do not (yet, anyway.. maybe in v13) have a way to GRANT read access to all tables in a database to be able to perform a database-wide export of the dat (using pg_dump). For replication, you need to create a user with the 'replication' role attribute and configure pg_hba.conf to allow the client to connect to the replication database. Thanks, Stephen --ZwycGzhRzgIApymG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdn0tLAAoJEO1sijiDR2RVxIoP/1JS9ApZwImkKi267eJziqGj LjzTt0IomWivx8kXm8ZZ0XtH9X3+Akn9Ykt/MTFu9PW2C7m7kskN8ugo4jQxo7Vj 3CLgHOZKeB0DrNlHX1YOh7OFJp4HvMceqYDRhtZoivECW+5KnDlpQrcTw2TcqpDA P+vkAhkN9mdliQvxwdXsp2Uq5AxL8djKSDrRIpsFQgYhU4GEuyxSx/ZjZvFXviBW YF13mJCh99VndTN5wrgNz9yHdw8jFY49mDqjzl7sbPfV4lKKUpmzwtJG9ZdwKKad juDGefjUOUV0dWtr4f23GicaR1+uv80pNgjz1KD/9CKaqUsN8oHjRTivNYt9Dmvb F4rYTjsd27919hyznxU5/qBC5e/70ebFyothSehCa7paw+YRXgTVN2Zl/U5R59l4 UyLV7mGfTXX0GgrjZADAtQE7HES9k2vl+giYguHBl6jlnqji23+ZBLJEupGx02Bv Jh6/4h0cU46gell0ZOFE8Ug4qGhrbMlsThRcKPzkEE0Exn+XbRHkhqPVFmz6HUzo 5wHVuR+Qo2v73wg8w4cjlvto3gAc2IElufqFXhfodp4jrFEUwp8ul+ginpvMq53h N2IUCbFUonKmdLzUmToaHwshRnRxjd/gc4B9kju29givjsO+yWkqyuF5ngL34m1u GXF8H2mno/MKCR4xjiUz =XuGW -----END PGP SIGNATURE----- --ZwycGzhRzgIApymG--