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 1srJRV-000YBL-HJ for pgsql-admin@arkaria.postgresql.org; Thu, 19 Sep 2024 15:51:42 +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 1srJQU-003Iui-UI for pgsql-admin@arkaria.postgresql.org; Thu, 19 Sep 2024 15:50:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srJQU-003IqO-IK for pgsql-admin@lists.postgresql.org; Thu, 19 Sep 2024 15:50:39 +0000 Received: from jakobs.com ([85.214.83.89] helo=rs.plausibolo.de) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srJQO-0001vM-PH for pgsql-admin@lists.postgresql.org; Thu, 19 Sep 2024 15:50:38 +0000 Received: from localhost (localhost [127.0.0.1]) by rs.plausibolo.de (Postfix) with ESMTP id 6E43E380603 for ; Thu, 19 Sep 2024 17:50:28 +0200 (CEST) Received: from rs.plausibolo.de ([127.0.0.1]) by localhost (h2367442.stratoserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X_lv3cWFe9ak for ; Thu, 19 Sep 2024 17:50:28 +0200 (CEST) Received: from [127.0.0.1] (dynamic-176-007-151-074.176.7.pool.telefonica.de [176.7.151.74]) by rs.plausibolo.de (Postfix) with ESMTPSA id E87ED3802A1 for ; Thu, 19 Sep 2024 17:50:27 +0200 (CEST) Date: Thu, 19 Sep 2024 17:50:27 +0200 From: Holger Jakobs To: pgsql-admin@lists.postgresql.org Subject: Re: How to make superuser from non superuser in PostgreSQL User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <1D39ED30-ABEB-4F1A-9080-B42539F78AFA@jakobs.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----0PSB4KZGWL136WNTJSRW3G1N2A2AZ7 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------0PSB4KZGWL136WNTJSRW3G1N2A2AZ7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable If the database system is running on a machine you have access to, you migh= t start it in single user mode and establish a new superuser role or change= the password=2E=20 Directly from SQL this isn't possible as it would make all restrictions us= eless=2E=20 --=20 Holger Jakobs, Bergisch Gladbach=20 Tel=2E +49 178 9759012 Am 19=2E September 2024 17:06:57 MESZ schrieb "David G=2E Johnston" : >On Thursday, September 19, 2024, Sunil Jadhav >wrote: > >> >> I don't know the superuser password? >> >> >You will need to figure out a way to login as the (an?) existing >superuser=2E Typically a password is not required since the pg_hba=2Econ= f file >usually has a =E2=80=9Clocal postgres postgres peer=E2=80=9D (or equivale= nt) entry which >lets the DBA become the OS postgres (or whatever user owns the service) >user and then just connect to the cluster using the postgres role=2E >Regardless, your ability to becomes superuser depends at this point on >being able to become the OS user that owns the PostgreSQL service so you >can modify pg_hba=2Econf to let you login=2E > >David J=2E ------0PSB4KZGWL136WNTJSRW3G1N2A2AZ7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
If the database system is runnin= g on a machine you have access to, you might start it in single user mode a= nd establish a new superuser role or change the password=2E

Directl= y from SQL this isn't possible as it would make all restrictions useless=2E=
--
Holger = Jakobs, Bergisch Gladbach
Tel=2E +49 178 9759012


Am 19=2E September 2024 17:06:57 = MESZ schrieb "David G=2E Johnston" <david=2Eg=2Ejohnston@gmail=2Ecom>= :


On Thursday, September 19, 2024, Sunil Jadhav <sunilbjpatil@gmail=2Ecom> wrote:

I don'= t know the superuser password?


You will need to figure out a way to login as t= he (an?) existing superuser=2E  Typically a password is not required s= ince the pg_hba=2Econf file usually has a =E2=80=9Clocal postgres postgres = peer=E2=80=9D (or equivalent) entry which lets the DBA become the OS postgr= es (or whatever user owns the service) user and then just connect to the cl= uster using the postgres role=2E  Regardless, your ability to becomes = superuser depends at this point on being able to become the OS user that ow= ns the PostgreSQL service so you can modify pg_hba=2Econf to let you login= =2E

David J=2E

------0PSB4KZGWL136WNTJSRW3G1N2A2AZ7--