File: create_user.l.html

package info (click to toggle)
mpsql 2.0-2
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 2,912 kB
  • ctags: 5,665
  • sloc: ansic: 34,322; makefile: 3,525; sh: 17
file content (109 lines) | stat: -rw-r--r-- 4,738 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!-- manual page source format generated by PolyglotMan v3.0.4, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->

<HTML>
<HEAD>
<TITLE>"CREATE(USER") manual page</TITLE>
</HEAD>
<BODY>
<A HREF="sql.html">SQL Reference Contents</A>
 
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
create user -- create a new user within a PostgreSQL instance  
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS 
</A></H2>
<B>create user &lt;username&gt; </B><BR>
 <tt> </tt><tt> </tt><tt> </tt><tt> </tt>[<B>with password </B> password] <BR>
 <tt> </tt><tt> </tt><tt> </tt><tt> </tt>[<B>createdb </B> | <B>nocreatedb 
</B>] <BR>
 <tt> </tt><tt> </tt><tt> </tt><tt> </tt>[<B>createuser </B> | <B>nocreateuser </B>] <BR>
 <tt> </tt><tt> </tt><tt> </tt><tt> </tt>[<B>in group </B> group-1, ..., group-n] <BR>
 <tt> </tt><tt> </tt><tt> </tt><tt> </tt>[<B>valid 
until ' </B>abstime<B>' </B>] <BR>
  
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
<B>create user</B> will add a new user to an instance 
of PostgreSQL.  The new user will be given a usesysid of 'SELECT max(usesysid) 
+ 1 FROM pg_user'.  This means that a PostgreSQL user's usesysid will not 
correspond to their operating system(OS) user id.  The exception to this 
rule is the 'postgres' user, whose OS user id is used as the usesysid during 
the initdb process.  If you still want the OS user id and the usesysid 
to match for any given user, then use the <A HREF="createuser.1.html">createuser(1)</A>
 script provided 
with the PostgreSQL distribution.  <P>
 The 'with password' clause sets the user's 
password within the pg_user relation.  For this reason, pg_user is no longer 
accessible to the  instance of PostgreSQL that the postgres user's password 
is initially set to NULL.  When a user's password in the pg_user relation 
is NULL, then user authentication proceeds as it historically has (HBA, 
PG_PASSWORD, etc).  However, if a password is set for a user, then a new 
authentication system supplants any other configured for the PostgreSQL 
instance, and the password stored in the pg_user relation is used for 
authentication.  For more details on how this authentication system functions 
see <A HREF="pg_crypt.3.html">pg_crypt(3)</A>
.  If the 'with password' clause is omitted, then the user's 
password is set to the empty string with equates to a NULL value in the 
authentication system mentioned above.  <P>
 The createdb/nocreatedb clause 
defines a user's ability to create databases.  If createdb is specified, 
then the user being defined will be allowed to create his/her own databases. 
 Using nocreatedb will deny a user the ability to create databases.  If 
this clause is omitted, then nocreatedb is used by default.  <P>
 The createuser/nocreateuser 
clause allows/prevents a user from creating new users in an instance of 
PostgreSQL.  Omitting this clause will set the user's value of this attribute 
to be nocreateuser.  <P>
 At the current time the 'in group' clause is non-functional. 
 The intent is to use this clause to affect the groups a user is a member 
of (as defined in the pg_group relation).  <P>
 Finally, the 'valid until' clause 
sets an absolute time after which the user's PostgreSQL login is no longer 
valid.  Please note that if a user does not have a password defined in 
the pg_user relation, then the valid until date will not be checked during 
user authentication.  If this clause is omitted, then a NULL value is stored 
in pg_user for this attribute, and the login will be valid for all time. 
 <P>
  
<H2><A NAME="sect3" HREF="#toc3">EXAMPLES </A></H2>
--- <BR>
 --- Create a user with no password <BR>
 --- <BR>
 create user tab; <BR>
 --- <BR>
 --- 
Create a user with a password <BR>
 --- <BR>
 create user tab with password jw8s0F4; 
<BR>
 --- <BR>
 --- Create a user with a password, whose account is valid thru 2001 <BR>
 --- 
Note that after one second has ticked in 2002, the account is not <BR>
 --- valid 
<BR>
 --- <BR>
 create user tab with password jw8s0F4 valid until 'Jan 1 2002'; <BR>
 --- <BR>
 --- Create 
an account where the user can create databases. <BR>
 --- <BR>
 create user tab with 
password jw8s0F4 createdb; <BR>
  
<H2><A NAME="sect4" HREF="#toc4">SEE ALSO </A></H2>
<A HREF="pg_crypt.3.html">pg_crypt(3)</A>
, <A HREF="alter_user.l.html">alter_user(l)</A>
, <A HREF="drop_user.l.html">drop_user(l)</A>
. 
<P>

<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<LI><A NAME="toc3" HREF="#sect3">EXAMPLES</A></LI>
<LI><A NAME="toc4" HREF="#sect4">SEE ALSO</A></LI>
</UL>
</BODY></HTML>