2
$PostgreSQL: pgsql/doc/src/sgml/ref/createuser.sgml,v 1.39 2003-11-29 19:51:38 pgsql Exp $
3
PostgreSQL documentation
6
<refentry id="APP-CREATEUSER">
8
<refentrytitle id="APP-CREATEUSER-TITLE"><application>createuser</application></refentrytitle>
9
<manvolnum>1</manvolnum>
10
<refmiscinfo>Application</refmiscinfo>
14
<refname>createuser</refname>
15
<refpurpose>define a new <productname>PostgreSQL</productname> user account</refpurpose>
18
<indexterm zone="app-createuser">
19
<primary>createuser</primary>
24
<command>createuser</command>
25
<arg rep="repeat"><replaceable>option</replaceable></arg>
26
<arg><replaceable>username</replaceable></arg>
32
<title>Description</title>
34
<application>createuser</application> creates a
35
new <productname>PostgreSQL</productname> user.
36
Only superusers (users with <literal>usesuper</literal> set in
37
the <literal>pg_shadow</literal> table) can create
38
new <productname>PostgreSQL</productname> users,
39
so <application>createuser</application> must be
40
invoked by someone who can connect as a <productname>PostgreSQL</productname>
45
Being a superuser also implies the ability to bypass access permission
46
checks within the database, so superuserdom should not be granted lightly.
50
<application>createuser</application> is a wrapper around the
51
<acronym>SQL</acronym> command <xref linkend="SQL-CREATEUSER"
52
endterm="SQL-CREATEUSER-title">.
53
There is no effective difference between creating users via
54
this utility and via other methods for accessing the server.
61
<title>Options</title>
64
<application>createuser</> accepts the following command-line arguments:
68
<term><replaceable class="parameter">username</replaceable></term>
71
Specifies the name of the <productname>PostgreSQL</productname> user to be created.
72
This name must be unique among all <productname>PostgreSQL</productname> users.
78
<term><option>-a</></term>
79
<term><option>--adduser</></term>
82
The new user is allowed to create other users.
83
(Note: Actually, this makes the new user a <emphasis>superuser</>.
84
The option is poorly named.)
90
<term><option>-A</></term>
91
<term><option>--no-adduser</></term>
94
The new user is not allowed to create other users (i.e.,
95
the new user is a regular user, not a superuser).
102
<term><option>-d</></term>
103
<term><option>--createdb</></term>
106
The new user is allowed to create databases.
112
<term><option>-D</></term>
113
<term><option>--no-createdb</></term>
116
The new user is not allowed to create databases.
123
<term><option>-e</></term>
124
<term><option>--echo</></term>
127
Echo the commands that <application>createuser</application> generates
128
and sends to the server.
134
<term><option>-E</></term>
135
<term><option>--encrypted</></term>
138
Encrypts the user's password stored in the database. If not
139
specified, the default password behavior is used.
145
<term><option>-i <replaceable class="parameter">number</replaceable></></term>
146
<term><option>--sysid <replaceable class="parameter">number</replaceable></></term>
149
Allows you to pick a non-default user ID for the new user. This is not
150
necessary, but some people like it.
156
<term><option>-N</></term>
157
<term><option>--unencrypted</></term>
160
Does not encrypt the user's password stored in the database. If
161
not specified, the default password behavior is used.
167
<term><option>-P</></term>
168
<term><option>--pwprompt</></term>
171
If given, <application>createuser</application> will issue a prompt for
172
the password of the new user. This is not necessary if you do not plan
173
on using password authentication.
179
<term><option>-q</></term>
180
<term><option>--quiet</></term>
183
Do not display a response.
191
You will be prompted for a name and other missing information if it
192
is not specified on the command line.
196
<application>createuser</application> also accepts the following
197
command-line arguments for connection parameters:
201
<term><option>-h <replaceable class="parameter">host</replaceable></></term>
202
<term><option>--host <replaceable class="parameter">host</replaceable></></term>
205
Specifies the host name of the machine on which the
207
is running. If the value begins with a slash, it is used
208
as the directory for the Unix domain socket.
214
<term><option>-p <replaceable class="parameter">port</replaceable></></term>
215
<term><option>--port <replaceable class="parameter">port</replaceable></></term>
218
Specifies the TCP port or local Unix domain socket file
219
extension on which the server
220
is listening for connections.
226
<term><option>-U <replaceable class="parameter">username</replaceable></></term>
227
<term><option>--username <replaceable class="parameter">username</replaceable></></term>
230
User name to connect as (not the user name to create).
236
<term><option>-W</></term>
237
<term><option>--password</></term>
240
Force password prompt (to connect to the server, not for the
241
password of the new user).
251
<title>Environment</title>
255
<term><envar>PGHOST</envar></term>
256
<term><envar>PGPORT</envar></term>
257
<term><envar>PGUSER</envar></term>
261
Default connection parameters
270
<title>Diagnostics</title>
273
In case of difficulty, see <xref linkend="SQL-CREATEUSER"
274
endterm="sql-createuser-title"> and <xref linkend="APP-PSQL"> for
275
discussions of potential problems and error messages.
276
The database server must be running at the
277
targeted host. Also, any default connection settings and environment
278
variables used by the <application>libpq</application> front-end
286
<title>Examples</title>
289
To create a user <literal>joe</literal> on the default database
292
<prompt>$ </prompt><userinput>createuser joe</userinput>
293
<computeroutput>Is the new user allowed to create databases? (y/n) </computeroutput><userinput>n</userinput>
294
<computeroutput>Shall the new user be allowed to create more new users? (y/n) </computeroutput><userinput>n</userinput>
295
<computeroutput>CREATE USER</computeroutput>
300
To create the same user <literal>joe</literal> using the
301
server on host <literal>eden</>, port 5000, avoiding the prompts and
302
taking a look at the underlying command:
304
<prompt>$ </prompt><userinput>createuser -p 5000 -h eden -D -A -e joe</userinput>
305
<computeroutput>CREATE USER "joe" NOCREATEDB NOCREATEUSER</computeroutput>
306
<computeroutput>CREATE USER</computeroutput>
313
<title>See Also</title>
315
<simplelist type="inline">
316
<member><xref linkend="app-dropuser"></member>
317
<member><xref linkend="sql-createuser" endterm="sql-createuser-title"></member>
323
<!-- Keep this comment at the end of the file
328
sgml-minimize-attributes:nil
329
sgml-always-quote-attributes:t
332
sgml-parent-document:nil
333
sgml-default-dtd-file:"../reference.ced"
334
sgml-exposed-tags:nil
335
sgml-local-catalogs:"/usr/lib/sgml/catalog"
336
sgml-local-ecat-files:nil