|
| 1 | +.\" This is -*-nroff-*- |
| 2 | +.\" XXX standard disclaimer belongs here.... |
| 3 | +.\" $Header: /cvsroot/pgsql/src/man/Attic/create_user.l,v 1.1 1998/01/25 07:42:01 scrappy Exp $ |
| 4 | +.TH "CREATE USER" SQL 01/26/98 PostgreSQL PostgreSQL |
| 5 | +.SH NAME |
| 6 | +create user -- create a new user within a PostgreSQL instance |
| 7 | +.SH SYNOPSIS |
| 8 | +.nf |
| 9 | +\fBcreate user <username> |
| 10 | + [\fBwith password\fR password] |
| 11 | + [\fBcreatedb\fR | \fBnocreatedb\fR] |
| 12 | + [\fBcreateuser\fR | \fBnocreateuser\fR] |
| 13 | + [\fBin group\fR group-1, ..., group-n] |
| 14 | + [\fBvalid until '\fRabstime\fB'\fR] |
| 15 | +.fi |
| 16 | +.SH DESCRIPTION |
| 17 | +.BR "create user" |
| 18 | +will add a new user to an instance of PostgreSQL. The new user will be |
| 19 | +given a usesysid of 'SELECT max(usesysid) + 1 FROM pg_user'. This means |
| 20 | +that a PostgreSQL user's usesysid will not correspond to their operating |
| 21 | +system(OS) user id. The exception to this rule is the 'postgres' user, |
| 22 | +whose OS user id is used as the usesysid during the initdb process. If |
| 23 | +you still want the OS user id and the usesysid to match for any given |
| 24 | +user, then use the createuser(1) script provided with the PostgreSQL |
| 25 | +distribution. |
| 26 | + |
| 27 | +The 'with password' clause sets the user's password within the pg_user |
| 28 | +relation. For this reason, pg_user is no longer accessible to the |
| 29 | +'public' group. Please note that when initdb(1) is executed for an |
| 30 | +instance of PostgreSQL that the postgres user's password is initially set |
| 31 | +to NULL. When a user's password in the pg_user relation is NULL, then |
| 32 | +user authentication proceeds as it historically has (HBA, PG_PASSWORD, |
| 33 | +etc). However, if a password is set for a user, then a new authentication |
| 34 | +system supplants any other configured for the PostgreSQL instance, and the |
| 35 | +password stored in the pg_user relation is used for authentication. For |
| 36 | +more details on how this authentication system functions see pg_crypt(3). |
| 37 | +If the 'with password' clause is omitted, then the user's password is set |
| 38 | +to the empty string with equates to a NULL value in the authentication |
| 39 | +system mentioned above. |
| 40 | + |
| 41 | +The createdb/nocreatedb clause defines a user's ability to create |
| 42 | +databases. If createdb is specified, then the user being defined will be |
| 43 | +allowed to create his/her own databases. Using nocreatedb will deny a |
| 44 | +user the ability to create databases. If this clause is omitted, then |
| 45 | +nocreatedb is used by default. |
| 46 | + |
| 47 | +The createuser/nocreateuser clause allows/prevents a user from creating |
| 48 | +new users in an instance of PostgreSQL. Omitting this clause will set the |
| 49 | +user's value of this attribute to be nocreateuser. |
| 50 | + |
| 51 | +At the current time the 'in group' clause is non-functional. The intent |
| 52 | +is to use this clause to affect the groups a user is a member of (as |
| 53 | +defined in the pg_group relation). |
| 54 | + |
| 55 | +Finally, the 'valid until' clause sets an absolute time after which the |
| 56 | +user's PostgreSQL login is no longer valid. Please note that if a user |
| 57 | +does not have a password defined in the pg_user relation, then the valid |
| 58 | +until date will not be checked during user authentication. If this clause |
| 59 | +is omitted, then a NULL value is stored in pg_user for this attribute, and |
| 60 | +the login will be valid for all time. |
| 61 | + |
| 62 | +.SH EXAMPLES |
| 63 | +.nf |
| 64 | +--- |
| 65 | +--- Create a user with no password |
| 66 | +--- |
| 67 | +create user tab; |
| 68 | +.fi |
| 69 | +.nf |
| 70 | +--- |
| 71 | +--- Create a user with a password |
| 72 | +--- |
| 73 | +create user tab with password jw8s0F4; |
| 74 | +.fi |
| 75 | +.nf |
| 76 | +--- |
| 77 | +--- Create a user with a password, whose account is valid thru 2001 |
| 78 | +--- Note that after one second has ticked in 2002, the account is not |
| 79 | +--- valid |
| 80 | +--- |
| 81 | +create user tab with password jw8s0F4 valid until 'Jan 1 2002'; |
| 82 | +.fi |
| 83 | +.nf |
| 84 | +--- |
| 85 | +--- Create an account where the user can create databases. |
| 86 | +--- |
| 87 | +create user tab with password jw8s0F4 createdb; |
| 88 | +.fi |
| 89 | +.SH "SEE ALSO" |
| 90 | +pg_crypt(3), alter_user(l), drop_user(l). |
0 commit comments