Re: CREATE USER and pg_user

Lists: pgsql-hackers
From: "William ZHANG" <uniware(at)zedware(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: CREATE USER and pg_user
Date: 2005-08-12 10:11:54
Message-ID: ddhspr$2c4g$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"create user foo with createdb" will create a user with createdb privilege.
"create user bar with createuser" will create s superuser who can createdb,
createuser, and update system catalog.

Why not change the option "createuser" to "superuser", or do something
to make is easier to understand?

--
Best regards,

William ZHANG


From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: William ZHANG <uniware(at)zedware(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE USER and pg_user
Date: 2005-08-12 13:55:09
Message-ID: 20050812135509.GA3284@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Aug 12, 2005 at 18:11:54 +0800,
William ZHANG <uniware(at)zedware(dot)org> wrote:
> "create user foo with createdb" will create a user with createdb privilege.
> "create user bar with createuser" will create s superuser who can createdb,
> createuser, and update system catalog.
>
> Why not change the option "createuser" to "superuser", or do something
> to make is easier to understand?

Currently being able to create users is effectively the same as having
superuser privileges, because if you weren't already a superuser, you
could just create one to get that access.
Recently there was some discussion about having a createuser ability that
only allowed one to create nonsuperuser accounts. From the development
docs it looks like this is going to be in 8.1. However it looks like
CREATEUSER privilege will continue to be an alias for super user access.
I didn't notice a documentation update for the createuser program and
don't know if it will take the new keywords or not.
For more information take a look at the CREATE ROLE command in the
developer docs.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "William ZHANG" <uniware(at)zedware(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE USER and pg_user
Date: 2005-08-12 14:41:50
Message-ID: 7731.1123857710@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"William ZHANG" <uniware(at)zedware(dot)org> writes:
> Why not change the option "createuser" to "superuser",

Backwards compatibility with existing dump files.

> or do something to make is easier to understand?

See
http://developer.postgresql.org/docs/postgres/sql-createrole.html

SUPERUSER
NOSUPERUSER

These clauses determine whether the new role is a "superuser", who can override all access restrictions within the
database. Superuser status is dangerous and should be used only when really needed. You must yourself be a
superuser to create a new superuser. If not specified, NOSUPERUSER is the default.

...

CREATEUSER
NOCREATEUSER

These clauses are an obsolete, but still accepted, spelling of SUPERUSER and NOSUPERUSER. Note that they are
not equivalent to CREATEROLE as one might naively expect!

regards, tom lane


From: "William ZHANG" <uniware(at)zedware(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE USER and pg_user
Date: 2005-08-13 12:47:30
Message-ID: ddkq4r$2nmh$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:7731(dot)1123857710(at)sss(dot)pgh(dot)pa(dot)us(dot)(dot)(dot)
> "William ZHANG" <uniware(at)zedware(dot)org> writes:
> > Why not change the option "createuser" to "superuser",
>
> Backwards compatibility with existing dump files.
>
> > or do something to make is easier to understand?
>
> See
> http://developer.postgresql.org/docs/postgres/sql-createrole.html
>

Got the idea.
And I found that pgsql's role is very intresting. Will read it carefully.


From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>, William ZHANG <uniware(at)zedware(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE USER and pg_user
Date: 2005-08-22 18:59:09
Message-ID: 20050822185909.GX95876@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Aug 12, 2005 at 08:55:09AM -0500, Bruno Wolff III wrote:
> On Fri, Aug 12, 2005 at 18:11:54 +0800,
> William ZHANG <uniware(at)zedware(dot)org> wrote:
> > "create user foo with createdb" will create a user with createdb privilege.
> > "create user bar with createuser" will create s superuser who can createdb,
> > createuser, and update system catalog.
> >
> > Why not change the option "createuser" to "superuser", or do something
> > to make is easier to understand?
>
> Currently being able to create users is effectively the same as having
> superuser privileges, because if you weren't already a superuser, you
> could just create one to get that access.
> Recently there was some discussion about having a createuser ability that
> only allowed one to create nonsuperuser accounts. From the development
> docs it looks like this is going to be in 8.1. However it looks like
> CREATEUSER privilege will continue to be an alias for super user access.
> I didn't notice a documentation update for the createuser program and
> don't know if it will take the new keywords or not.
> For more information take a look at the CREATE ROLE command in the
> developer docs.

ISTM that it's a bug to be able to assign permissions that you don't
yourself have. In this case, if you have CREATEROLE but not SUPERUSER,
then you should be able to create roles, but not ones that have
SUPERUSER status. If this isn't how it currently works then there should
be a big warning under CREATEROLE.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com 512-569-9461


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, William ZHANG <uniware(at)zedware(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE USER and pg_user
Date: 2005-08-22 20:17:49
Message-ID: 20865.1124741869@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> On Fri, Aug 12, 2005 at 08:55:09AM -0500, Bruno Wolff III wrote:
>> For more information take a look at the CREATE ROLE command in the
>> developer docs.

> ISTM that it's a bug to be able to assign permissions that you don't
> yourself have. In this case, if you have CREATEROLE but not SUPERUSER,
> then you should be able to create roles, but not ones that have
> SUPERUSER status. If this isn't how it currently works then there should
> be a big warning under CREATEROLE.

Did you read the docs Bruno pointed you to?

http://developer.postgresql.org/docs/postgres/sql-createrole.html

regards, tom lane