OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / doc / postgresql / html / app-createuser.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >createuser</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
9 REV="MADE"
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
11 REL="HOME"
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
14 REL="UP"
15 TITLE="PostgreSQL Client Applications"
16 HREF="reference-client.html"><LINK
17 REL="PREVIOUS"
18 TITLE="createlang"
19 HREF="app-createlang.html"><LINK
20 REL="NEXT"
21 TITLE="dropdb"
22 HREF="app-dropdb.html"><LINK
23 REL="STYLESHEET"
24 TYPE="text/css"
25 HREF="stylesheet.css"><META
26 NAME="creation"
27 CONTENT="2003-12-22T03:48:47"></HEAD
28 ><BODY
29 CLASS="REFENTRY"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="5"
41 ALIGN="center"
42 VALIGN="bottom"
43 >PostgreSQL 7.4.1 Documentation</TH
44 ></TR
45 ><TR
46 ><TD
47 WIDTH="10%"
48 ALIGN="left"
49 VALIGN="top"
50 ><A
51 HREF="app-createlang.html"
52 ACCESSKEY="P"
53 >Prev</A
54 ></TD
55 ><TD
56 WIDTH="10%"
57 ALIGN="left"
58 VALIGN="top"
59 ><A
60 HREF="app-createlang.html"
61 >Fast Backward</A
62 ></TD
63 ><TD
64 WIDTH="60%"
65 ALIGN="center"
66 VALIGN="bottom"
67 ></TD
68 ><TD
69 WIDTH="10%"
70 ALIGN="right"
71 VALIGN="top"
72 ><A
73 HREF="app-dropdb.html"
74 >Fast Forward</A
75 ></TD
76 ><TD
77 WIDTH="10%"
78 ALIGN="right"
79 VALIGN="top"
80 ><A
81 HREF="app-dropdb.html"
82 ACCESSKEY="N"
83 >Next</A
84 ></TD
85 ></TR
86 ></TABLE
87 ><HR
88 ALIGN="LEFT"
89 WIDTH="100%"></DIV
90 ><H1
91 ><A
92 NAME="APP-CREATEUSER"
93 ></A
94 ><SPAN
95 CLASS="APPLICATION"
96 >createuser</SPAN
97 ></H1
98 ><DIV
99 CLASS="REFNAMEDIV"
100 ><A
101 NAME="AEN43566"
102 ></A
103 ><H2
104 >Name</H2
105 >createuser&nbsp;--&nbsp;define a new <SPAN
106 CLASS="PRODUCTNAME"
107 >PostgreSQL</SPAN
108 > user account</DIV
109 ><A
110 NAME="AEN43570"
111 ></A
112 ><DIV
113 CLASS="REFSYNOPSISDIV"
114 ><A
115 NAME="AEN43572"
116 ></A
117 ><H2
118 >Synopsis</H2
119 ><P
120 ><TT
121 CLASS="COMMAND"
122 >createuser</TT
123 > [<VAR
124 CLASS="REPLACEABLE"
125 >option</VAR
126 >...] [<VAR
127 CLASS="REPLACEABLE"
128 >username</VAR
129 >]</P
130 ></DIV
131 ><DIV
132 CLASS="REFSECT1"
133 ><A
134 NAME="AEN43579"
135 ></A
136 ><H2
137 >Description</H2
138 ><P
139 >   <SPAN
140 CLASS="APPLICATION"
141 >createuser</SPAN
142 > creates a 
143    new <SPAN
144 CLASS="PRODUCTNAME"
145 >PostgreSQL</SPAN
146 > user.  
147    Only superusers (users with <TT
148 CLASS="LITERAL"
149 >usesuper</TT
150 > set in
151    the <TT
152 CLASS="LITERAL"
153 >pg_shadow</TT
154 > table) can create 
155    new <SPAN
156 CLASS="PRODUCTNAME"
157 >PostgreSQL</SPAN
158 > users,
159    so <SPAN
160 CLASS="APPLICATION"
161 >createuser</SPAN
162 > must be
163    invoked by someone who can connect as a <SPAN
164 CLASS="PRODUCTNAME"
165 >PostgreSQL</SPAN
166 >
167    superuser.
168   </P
169 ><P
170 >   Being a superuser also implies the ability to bypass access permission
171    checks within the database, so superuserdom should not be granted lightly.
172   </P
173 ><P
174 >   <SPAN
175 CLASS="APPLICATION"
176 >createuser</SPAN
177 > is a wrapper around the
178    <ACRONYM
179 CLASS="ACRONYM"
180 >SQL</ACRONYM
181 > command <A
182 HREF="sql-createuser.html"
183 ><I
184 >CREATE USER</I
185 ></A
186 >.
187    There is no effective difference between creating users via
188    this utility and via other methods for accessing the server.
189   </P
190 ></DIV
191 ><DIV
192 CLASS="REFSECT1"
193 ><A
194 NAME="AEN43594"
195 ></A
196 ><H2
197 >Options</H2
198 ><P
199 >   <SPAN
200 CLASS="APPLICATION"
201 >createuser</SPAN
202 > accepts the following command-line arguments:
203
204     <P
205 ></P
206 ></P><DIV
207 CLASS="VARIABLELIST"
208 ><DL
209 ><DT
210 ><VAR
211 CLASS="REPLACEABLE"
212 >username</VAR
213 ></DT
214 ><DD
215 ><P
216 >       Specifies the name of the <SPAN
217 CLASS="PRODUCTNAME"
218 >PostgreSQL</SPAN
219 > user to be created. 
220         This name must be unique among all <SPAN
221 CLASS="PRODUCTNAME"
222 >PostgreSQL</SPAN
223 > users.
224        </P
225 ></DD
226 ><DT
227 ><VAR
228 CLASS="OPTION"
229 >-a</VAR
230 ><BR><VAR
231 CLASS="OPTION"
232 >--adduser</VAR
233 ></DT
234 ><DD
235 ><P
236 >       The new user is allowed to create other users.
237         (Note: Actually, this makes the new user a <SPAN
238 CLASS="emphasis"
239 ><I
240 CLASS="EMPHASIS"
241 >superuser</I
242 ></SPAN
243 >.
244         The option is poorly named.)
245        </P
246 ></DD
247 ><DT
248 ><VAR
249 CLASS="OPTION"
250 >-A</VAR
251 ><BR><VAR
252 CLASS="OPTION"
253 >--no-adduser</VAR
254 ></DT
255 ><DD
256 ><P
257 >       The new user is not allowed to create other users (i.e.,
258         the new user is a regular user, not a superuser).
259         This is the default.
260        </P
261 ></DD
262 ><DT
263 ><VAR
264 CLASS="OPTION"
265 >-d</VAR
266 ><BR><VAR
267 CLASS="OPTION"
268 >--createdb</VAR
269 ></DT
270 ><DD
271 ><P
272 >       The new user is allowed to create databases.
273        </P
274 ></DD
275 ><DT
276 ><VAR
277 CLASS="OPTION"
278 >-D</VAR
279 ><BR><VAR
280 CLASS="OPTION"
281 >--no-createdb</VAR
282 ></DT
283 ><DD
284 ><P
285 >       The new user is not allowed to create databases.
286         This is the default.
287        </P
288 ></DD
289 ><DT
290 ><VAR
291 CLASS="OPTION"
292 >-e</VAR
293 ><BR><VAR
294 CLASS="OPTION"
295 >--echo</VAR
296 ></DT
297 ><DD
298 ><P
299 >        Echo the commands that <SPAN
300 CLASS="APPLICATION"
301 >createuser</SPAN
302 > generates
303         and sends to the server.
304        </P
305 ></DD
306 ><DT
307 ><VAR
308 CLASS="OPTION"
309 >-E</VAR
310 ><BR><VAR
311 CLASS="OPTION"
312 >--encrypted</VAR
313 ></DT
314 ><DD
315 ><P
316 >       Encrypts the user's password stored in the database. If not
317         specified, the default password behavior is used.
318        </P
319 ></DD
320 ><DT
321 ><VAR
322 CLASS="OPTION"
323 >-i <VAR
324 CLASS="REPLACEABLE"
325 >number</VAR
326 ></VAR
327 ><BR><VAR
328 CLASS="OPTION"
329 >--sysid <VAR
330 CLASS="REPLACEABLE"
331 >number</VAR
332 ></VAR
333 ></DT
334 ><DD
335 ><P
336 >       Allows you to pick a non-default user ID for the new user. This is not
337        necessary, but some people like it.
338        </P
339 ></DD
340 ><DT
341 ><VAR
342 CLASS="OPTION"
343 >-N</VAR
344 ><BR><VAR
345 CLASS="OPTION"
346 >--unencrypted</VAR
347 ></DT
348 ><DD
349 ><P
350 >       Does not encrypt the user's password stored in the database. If
351         not specified, the default password behavior is used.
352        </P
353 ></DD
354 ><DT
355 ><VAR
356 CLASS="OPTION"
357 >-P</VAR
358 ><BR><VAR
359 CLASS="OPTION"
360 >--pwprompt</VAR
361 ></DT
362 ><DD
363 ><P
364 >       If given, <SPAN
365 CLASS="APPLICATION"
366 >createuser</SPAN
367 > will issue a prompt for
368        the password of the new user. This is not necessary if you do not plan
369        on using password authentication.
370        </P
371 ></DD
372 ><DT
373 ><VAR
374 CLASS="OPTION"
375 >-q</VAR
376 ><BR><VAR
377 CLASS="OPTION"
378 >--quiet</VAR
379 ></DT
380 ><DD
381 ><P
382 >        Do not display a response.
383        </P
384 ></DD
385 ></DL
386 ></DIV
387 ><P>
388   </P
389 ><P
390 >   You will be prompted for a name and other missing information if it
391    is not specified on the command line.
392   </P
393 ><P
394 >   <SPAN
395 CLASS="APPLICATION"
396 >createuser</SPAN
397 > also accepts the following
398    command-line arguments for connection parameters:
399     
400    <P
401 ></P
402 ></P><DIV
403 CLASS="VARIABLELIST"
404 ><DL
405 ><DT
406 ><VAR
407 CLASS="OPTION"
408 >-h <VAR
409 CLASS="REPLACEABLE"
410 >host</VAR
411 ></VAR
412 ><BR><VAR
413 CLASS="OPTION"
414 >--host <VAR
415 CLASS="REPLACEABLE"
416 >host</VAR
417 ></VAR
418 ></DT
419 ><DD
420 ><P
421 >       Specifies the host name of the machine on which the 
422         server
423         is running.  If the value begins with a slash, it is used 
424         as the directory for the Unix domain socket.
425        </P
426 ></DD
427 ><DT
428 ><VAR
429 CLASS="OPTION"
430 >-p <VAR
431 CLASS="REPLACEABLE"
432 >port</VAR
433 ></VAR
434 ><BR><VAR
435 CLASS="OPTION"
436 >--port <VAR
437 CLASS="REPLACEABLE"
438 >port</VAR
439 ></VAR
440 ></DT
441 ><DD
442 ><P
443 >       Specifies the TCP port or local Unix domain socket file 
444         extension on which the server
445         is listening for connections.
446        </P
447 ></DD
448 ><DT
449 ><VAR
450 CLASS="OPTION"
451 >-U <VAR
452 CLASS="REPLACEABLE"
453 >username</VAR
454 ></VAR
455 ><BR><VAR
456 CLASS="OPTION"
457 >--username <VAR
458 CLASS="REPLACEABLE"
459 >username</VAR
460 ></VAR
461 ></DT
462 ><DD
463 ><P
464 >        User name to connect as (not the user name to create).
465        </P
466 ></DD
467 ><DT
468 ><VAR
469 CLASS="OPTION"
470 >-W</VAR
471 ><BR><VAR
472 CLASS="OPTION"
473 >--password</VAR
474 ></DT
475 ><DD
476 ><P
477 >        Force password prompt (to connect to the server, not for the
478         password of the new user).
479        </P
480 ></DD
481 ></DL
482 ></DIV
483 ><P>
484   </P
485 ></DIV
486 ><DIV
487 CLASS="REFSECT1"
488 ><A
489 NAME="AEN43719"
490 ></A
491 ><H2
492 >Environment</H2
493 ><P
494 ></P
495 ><DIV
496 CLASS="VARIABLELIST"
497 ><DL
498 ><DT
499 ><TT
500 CLASS="ENVAR"
501 >PGHOST</TT
502 ><BR><TT
503 CLASS="ENVAR"
504 >PGPORT</TT
505 ><BR><TT
506 CLASS="ENVAR"
507 >PGUSER</TT
508 ></DT
509 ><DD
510 ><P
511 >      Default connection parameters
512      </P
513 ></DD
514 ></DL
515 ></DIV
516 ></DIV
517 ><DIV
518 CLASS="REFSECT1"
519 ><A
520 NAME="AEN43731"
521 ></A
522 ><H2
523 >Diagnostics</H2
524 ><P
525 >   In case of difficulty, see <A
526 HREF="sql-createuser.html"
527 ><I
528 >CREATE USER</I
529 ></A
530 > and <A
531 HREF="app-psql.html"
532 ><SPAN
533 CLASS="APPLICATION"
534 >psql</SPAN
535 ></A
536 > for
537    discussions of potential problems and error messages.
538    The database server must be running at the
539    targeted host.  Also, any default connection settings and environment
540    variables used by the <SPAN
541 CLASS="APPLICATION"
542 >libpq</SPAN
543 > front-end
544    library will apply.
545   </P
546 ></DIV
547 ><DIV
548 CLASS="REFSECT1"
549 ><A
550 NAME="AEN43737"
551 ></A
552 ><H2
553 >Examples</H2
554 ><P
555 >    To create a user <TT
556 CLASS="LITERAL"
557 >joe</TT
558 > on the default database
559     server:
560 </P><PRE
561 CLASS="SCREEN"
562 ><SAMP
563 CLASS="PROMPT"
564 >$ </SAMP
565 ><KBD
566 CLASS="USERINPUT"
567 >createuser joe</KBD
568 >
569 <SAMP
570 CLASS="COMPUTEROUTPUT"
571 >Is the new user allowed to create databases? (y/n) </SAMP
572 ><KBD
573 CLASS="USERINPUT"
574 >n</KBD
575 >
576 <SAMP
577 CLASS="COMPUTEROUTPUT"
578 >Shall the new user be allowed to create more new users? (y/n) </SAMP
579 ><KBD
580 CLASS="USERINPUT"
581 >n</KBD
582 >
583 <SAMP
584 CLASS="COMPUTEROUTPUT"
585 >CREATE USER</SAMP
586 ></PRE
587 ><P>
588    </P
589 ><P
590 >    To create the same user <TT
591 CLASS="LITERAL"
592 >joe</TT
593 > using the
594     server on host <TT
595 CLASS="LITERAL"
596 >eden</TT
597 >, port 5000, avoiding the prompts and
598     taking a look at the underlying command:
599 </P><PRE
600 CLASS="SCREEN"
601 ><SAMP
602 CLASS="PROMPT"
603 >$ </SAMP
604 ><KBD
605 CLASS="USERINPUT"
606 >createuser -p 5000 -h eden -D -A -e joe</KBD
607 >
608 <SAMP
609 CLASS="COMPUTEROUTPUT"
610 >CREATE USER "joe" NOCREATEDB NOCREATEUSER</SAMP
611 >
612 <SAMP
613 CLASS="COMPUTEROUTPUT"
614 >CREATE USER</SAMP
615 ></PRE
616 ><P>
617    </P
618 ></DIV
619 ><DIV
620 CLASS="REFSECT1"
621 ><A
622 NAME="AEN43757"
623 ></A
624 ><H2
625 >See Also</H2
626 ><A
627 HREF="app-dropuser.html"
628 ><SPAN
629 CLASS="APPLICATION"
630 >dropuser</SPAN
631 ></A
632 >, <A
633 HREF="sql-createuser.html"
634 ><I
635 >CREATE USER</I
636 ></A
637 ></DIV
638 ><DIV
639 CLASS="NAVFOOTER"
640 ><HR
641 ALIGN="LEFT"
642 WIDTH="100%"><TABLE
643 SUMMARY="Footer navigation table"
644 WIDTH="100%"
645 BORDER="0"
646 CELLPADDING="0"
647 CELLSPACING="0"
648 ><TR
649 ><TD
650 WIDTH="33%"
651 ALIGN="left"
652 VALIGN="top"
653 ><A
654 HREF="app-createlang.html"
655 ACCESSKEY="P"
656 >Prev</A
657 ></TD
658 ><TD
659 WIDTH="34%"
660 ALIGN="center"
661 VALIGN="top"
662 ><A
663 HREF="index.html"
664 ACCESSKEY="H"
665 >Home</A
666 ></TD
667 ><TD
668 WIDTH="33%"
669 ALIGN="right"
670 VALIGN="top"
671 ><A
672 HREF="app-dropdb.html"
673 ACCESSKEY="N"
674 >Next</A
675 ></TD
676 ></TR
677 ><TR
678 ><TD
679 WIDTH="33%"
680 ALIGN="left"
681 VALIGN="top"
682 ><SPAN
683 CLASS="APPLICATION"
684 >createlang</SPAN
685 ></TD
686 ><TD
687 WIDTH="34%"
688 ALIGN="center"
689 VALIGN="top"
690 ><A
691 HREF="reference-client.html"
692 ACCESSKEY="U"
693 >Up</A
694 ></TD
695 ><TD
696 WIDTH="33%"
697 ALIGN="right"
698 VALIGN="top"
699 ><SPAN
700 CLASS="APPLICATION"
701 >dropdb</SPAN
702 ></TD
703 ></TR
704 ></TABLE
705 ></DIV
706 ></BODY
707 ></HTML
708 >