Re: Rename or Removing Postgres user

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Devendra Yadav <devendra(dot)857(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Rename or Removing Postgres user
Date: 2019-02-14 12:30:32
Message-ID: 391a608c085a9b3ba28dcea6ff891c185df1cbcf.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Devendra Yadav wrote:
> I want to know if I rename 'postgres' user to 'someuser' retaining it's privileges i.e superuser and other privileges.
>
> Or what if I drop the 'postgres' user and create a new superuser. I tried dropping Postgres user but it says "cannot drop role postgres because it is required by the database system".
>
> So my concern is what happens if I rename it. As far as I can check there's no impact, but in case anyone has faced issues regarding this, please suggest.

You can rename the user without any problems.
Internally, only the object ID of the role is used,
the name is just an entry in "pg_authid".

Resources outside the database proper, for example
configuration files like "pg_hba.conf", will have to
be adapted.

You cannot drop the "postgres" user, however.

You say further downthread that you want to do this
for security reasons. Keep in mind that this is the lowest
form of security: "security by obscurity".

For better security, make sure that the superuser can
only log in from the database machine itself, and that
only administrators get shell access there.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tim Cross 2019-02-14 12:36:58 Re: Rename or Removing Postgres user
Previous Message Devendra Yadav 2019-02-14 12:15:05 Re: Rename or Removing Postgres user