2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.6 1999/12/04 04:53:15 momjian Exp $
6 <refentry id="APP-CREATEUSER">
8 <refentrytitle id="APP-CREATEUSER-TITLE">
9 <application>createuser</application>
11 <refmiscinfo>Application</refmiscinfo>
15 <application>createuser</application>
18 Create a new <productname>PostgreSQL</productname> user
23 <date>1999-11-07</date>
27 createuser [ <replaceable class="parameter">options</replaceable> ] [ <replaceable class="parameter">username</replaceable> ]
30 <refsect2 id="R2-APP-CREATEUSER-1">
32 <date>1999-11-07</date>
41 <term>-h, --host <replaceable class="parameter">host</replaceable></term>
44 Specifies the hostname of the machine on which the
45 <application>postmaster</application>
52 <term>-p, --port <replaceable class="parameter">port</replaceable></term>
55 Specifies the Internet TCP/IP port or local Unix domain socket file
56 extension on which the <application>postmaster</application>
57 is listening for connections.
63 <term>-e, --echo</term>
66 Echo the queries that <application>createdb</application> generates
67 and sends to the backend.
73 <term>-q, --quiet</term>
76 Do not display a response.
82 <term>-d, --createdb</term>
85 Allows the new user to create databases.
91 <term>-D, --no-createdb</term>
94 Forbids the new user to create databases.
100 <term>-a, --adduser</term>
103 Allows the new user to create other users.
109 <term>-A, --no-adduser</term>
112 Forbids the new user to create other users.
118 <term>-P, --pwprompt</term>
121 If given, <application>createuser</application> will issue a prompt for
122 the password of the new user. This is not necessary if you do not plan
123 on using password authentication.
129 <term><replaceable class="parameter">username</replaceable></term>
132 Specifies the name of the <productname>PostgreSQL</productname> user to be created.
133 This name must be unique among all <productname>PostgreSQL</productname> users.
139 You will be prompted for a name and other missing information if it is not
140 specified on the command line.
144 The options <literal>-h</literal>, <literal>-p</literal>, and <literal>-e</literal>,
145 are passed on literally to <xref linkend="APP-PSQL" endterm="APP-PSQL-title">. If you
146 need the <application>psql</application> options <literal>-U</literal> and
147 <literal>-W</literal> as well, you can uncomment the
148 respective lines in the source. They are disabled by default because of the potential
149 conceptual confusion between existing and new users.
153 <refsect2 id="R2-APP-CREATEUSER-2">
155 <date>1999-11-07</date>
163 <term><computeroutput>CREATE USER</computeroutput></term>
172 <term><computeroutput>createuser: Creation of user "<replaceable class="parameter">username</replaceable>" failed.</computeroutput></term>
175 Something went wrong. The user was not created.
182 If there is an error condition, the backend error message will be displayed.
183 See <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">
184 and <xref linkend="APP-PSQL" endterm="APP-PSQL-title"> for possibilities.
189 <refsect1 id="R1-APP-CREATEUSER-1">
191 <date>1998-11-07</date>
197 <application>createuser</application> creates a
198 new <productname>PostgreSQL</productname> user.
199 Only users with <literal>usesuper</literal> set in
200 the <literal>pg_shadow</literal> class can create
201 new <productname>Postgres</productname> users.
205 <application>createuser</application> is a shell script wrapper around the
206 <acronym>SQL</acronym> command
207 <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title"> via
208 the <productname>PostgreSQL</productname> interactive terminal
209 <xref linkend="APP-PSQL" endterm="APP-PSQL-title">. Thus, there is nothing
210 special about creating users via this or other methods. This means
211 that the <application>psql</application> must be found by the script and that
212 a database server is running at the targeted host. Also, any default
213 settings and environment variables available to <application>psql</application>
214 and the <application>libpq</application> front-end library do apply.
220 <refsect1 id="R1-APP-CREATEUSER-2">
222 <date>1999-11-07</date>
228 To create a user <literal>joe</literal>
229 on the default database server:
232 $ <userinput>createuser joe</userinput>
233 Is the new user allowed to create databases? (y/n) <userinput>n</userinput>
234 Shall the new user be allowed to create more new users? (y/n) <userinput>n</userinput>
240 To create the same user <literal>joe</literal>
241 using the postmaster on host eden, port 5000, avoiding
242 the prompts and taking a look at the underlying query:
245 $ <userinput>createuser -p 5000 -h eden -D -A -e joe</userinput>
246 QUERY: CREATE USER "joe" NOCREATEDB NOCREATEUSER
254 <!-- Keep this comment at the end of the file
259 sgml-minimize-attributes:nil
260 sgml-always-quote-attributes:t
263 sgml-parent-document:nil
264 sgml-default-dtd-file:"../reference.ced"
265 sgml-exposed-tags:nil
266 sgml-local-catalogs:"/usr/lib/sgml/catalog"
267 sgml-local-ecat-files:nil