public inbox for [email protected]help / color / mirror / Atom feed
How to make superuser from non superuser in PostgreSQL 4+ messages / 4 participants [nested] [flat]
* How to make superuser from non superuser in PostgreSQL @ 2024-09-19 13:31 Sunil Jadhav <[email protected]> 2024-09-19 15:06 ` Re: How to make superuser from non superuser in PostgreSQL David G. Johnston <[email protected]> 2024-09-20 04:18 ` Re: How to make superuser from non superuser in PostgreSQL Muhammad Usman Khan <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: Sunil Jadhav @ 2024-09-19 13:31 UTC (permalink / raw) To: pgsql-admin Hello Team, I have login with non super user in PostgreSQL instance. How to become a super user I tried and getting a below error "must be superuser to alter superuser" How to resolve this? I don't know the superuser password? Thanks for your help in advance Thanks Sunil jadhav ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to make superuser from non superuser in PostgreSQL 2024-09-19 13:31 How to make superuser from non superuser in PostgreSQL Sunil Jadhav <[email protected]> @ 2024-09-19 15:06 ` David G. Johnston <[email protected]> 2024-09-19 15:50 ` Re: How to make superuser from non superuser in PostgreSQL Holger Jakobs <[email protected]> 1 sibling, 1 reply; 4+ messages in thread From: David G. Johnston @ 2024-09-19 15:06 UTC (permalink / raw) To: Sunil Jadhav <[email protected]>; +Cc: pgsql-admin On Thursday, September 19, 2024, Sunil Jadhav <[email protected]> wrote: > > I don't know the superuser password? > > You will need to figure out a way to login as the (an?) existing superuser. Typically a password is not required since the pg_hba.conf file usually has a “local postgres postgres peer” (or equivalent) 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. 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.conf to let you login. David J. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to make superuser from non superuser in PostgreSQL 2024-09-19 13:31 How to make superuser from non superuser in PostgreSQL Sunil Jadhav <[email protected]> 2024-09-19 15:06 ` Re: How to make superuser from non superuser in PostgreSQL David G. Johnston <[email protected]> @ 2024-09-19 15:50 ` Holger Jakobs <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Holger Jakobs @ 2024-09-19 15:50 UTC (permalink / raw) To: [email protected] If the database system is running on a machine you have access to, you might start it in single user mode and establish a new superuser role or change the password. Directly from SQL this isn't possible as it would make all restrictions useless. -- Holger Jakobs, Bergisch Gladbach Tel. +49 178 9759012 Am 19. September 2024 17:06:57 MESZ schrieb "David G. Johnston" <[email protected]>: >On Thursday, September 19, 2024, Sunil Jadhav <[email protected]> >wrote: > >> >> I don't know the superuser password? >> >> >You will need to figure out a way to login as the (an?) existing >superuser. Typically a password is not required since the pg_hba.conf file >usually has a “local postgres postgres peer” (or equivalent) 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. >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.conf to let you login. > >David J. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to make superuser from non superuser in PostgreSQL 2024-09-19 13:31 How to make superuser from non superuser in PostgreSQL Sunil Jadhav <[email protected]> @ 2024-09-20 04:18 ` Muhammad Usman Khan <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: Muhammad Usman Khan @ 2024-09-20 04:18 UTC (permalink / raw) To: Sunil Jadhav <[email protected]>; +Cc: pgsql-admin Hi, You can try the following options - Edit pg_hba.conf file and change authentication method to trust Reload postgres iand login without password psql -U postgres And then you can use alter command ALTER USER your_username WITH SUPERUSER; - If you have root access to the server than you can directly switch to postgres superuser sudo -i -u postgres psql ALTER USER your_username WITH SUPERUSER; - If you can't log in with sudo but have access to the PostgreSQL data directory, you can start PostgreSQL in single-user mode to reset the password sudo -u postgres postgres --single -D /var/lib/pgsql/data (Change your path accordingly) ALTER USER postgres WITH PASSWORD 'new_password'; Exit single user mode and start postgres normally On Thu, 19 Sept 2024 at 18:31, Sunil Jadhav <[email protected]> wrote: > Hello Team, > > I have login with non super user in PostgreSQL instance. > How to become a super user > I tried and getting a below error > "must be superuser to alter superuser" > How to resolve this? > I don't know the superuser password? > > Thanks for your help in advance > > Thanks > Sunil jadhav > ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-09-20 04:18 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-09-19 13:31 How to make superuser from non superuser in PostgreSQL Sunil Jadhav <[email protected]> 2024-09-19 15:06 ` David G. Johnston <[email protected]> 2024-09-19 15:50 ` Holger Jakobs <[email protected]> 2024-09-20 04:18 ` Muhammad Usman Khan <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox