-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-createuser.html
More file actions
397 lines (395 loc) · 32.8 KB
/
app-createuser.html
File metadata and controls
397 lines (395 loc) · 32.8 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>createuser</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-createdb.html" title="createdb" /><link rel="next" href="app-dropdb.html" title="dropdb" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-client.html" title="PostgreSQLクライアントアプリケーション">PostgreSQLクライアントアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 18.3 : app-createuser.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-createdb.html" title="createdb">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">createuser</span></td><td width="20%" align="right"> <a accesskey="n" href="app-dropdb.html" title="dropdb">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-CREATEUSER"><div class="titlepage"></div><a id="id-1.9.4.5.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">createuser</span></span></h2><p>createuser<span class="original">
<refpurpose>define a new <productname>PostgreSQL</productname> user account</refpurpose>
</span> — 新しい<span class="productname">PostgreSQL</span>のユーザアカウントを定義する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.4.5.4.1"><code class="command">createuser</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...] [<em class="replaceable"><code>username</code></em>]</p></div></div><div class="refsect1" id="id-1.9.4.5.5"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<application>createuser</application> creates a
new <productname>PostgreSQL</productname> user (or more precisely, a role).
Only superusers and users with <literal>CREATEROLE</literal> privilege can create
new users, so <application>createuser</application> must be
invoked by someone who can connect as a superuser or a user with
<literal>CREATEROLE</literal> privilege.
</span>
<span class="application">createuser</span>は新しい<span class="productname">PostgreSQL</span>のユーザ(より正確にいえばロール)を作成します。
新しいユーザを作成できるのは、スーパーユーザと<code class="literal">CREATEROLE</code>権限を持つユーザのみです。
したがって、<span class="application">createuser</span>は、スーパーユーザもしくは<code class="literal">CREATEROLE</code>権限を持つユーザとして接続可能なユーザによって実行されなければなりません。
</p><p>
<span class="original">
If you wish to create a role with the <literal>SUPERUSER</literal>,
<literal>REPLICATION</literal>, or <literal>BYPASSRLS</literal> privilege,
you must connect as a superuser, not merely with
<literal>CREATEROLE</literal> privilege.
Being a superuser implies the ability to bypass all access permission
checks within the database, so superuser access should not be granted
lightly. <literal>CREATEROLE</literal> also conveys
<link linkend="role-creation">very extensive privileges</link>.
</span>
<code class="literal">SUPERUSER</code>、<code class="literal">REPLICATION</code>、または<code class="literal">BYPASSRLS</code>権限を持つロールを作成したいのであれば、スーパーユーザとして接続しなければなりません。<code class="literal">CREATEROLE</code>権限だけではいけません。
スーパーユーザであるということは、そのデータベースにおけるアクセス権限の検査を素通りできることを意味しています。したがって、スーパーユーザのアクセス権を簡単に与えてはなりません。
<code class="literal">CREATEROLE</code>も<a class="link" href="role-attributes.html#ROLE-CREATION">非常に広範な権限</a>を付与します。
</p><p>
<span class="original">
<application>createuser</application> is a wrapper around the
<acronym>SQL</acronym> command <link linkend="sql-createrole"><command>CREATE ROLE</command></link>.
There is no effective difference between creating users via
this utility and via other methods for accessing the server.
</span>
<span class="application">createuser</span>は<acronym class="acronym">SQL</acronym>コマンド<a class="link" href="sql-createrole.html" title="CREATE ROLE"><code class="command">CREATE ROLE</code></a>のラッパーです。
このユーティリティによってユーザを作成しても、これ以外の方法でサーバにアクセスしてユーザを作成しても特に違いはありません。
</p></div><div class="refsect1" id="id-1.9.4.5.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
<application>createuser</application> accepts the following command-line arguments:
</span>
<span class="application">createuser</span>では、下記のコマンドライン引数を指定できます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>username</code></em></span></dt><dd><p>
<span class="original">
Specifies the name of the <productname>PostgreSQL</productname> user
to be created.
This name must be different from all existing roles in this
<productname>PostgreSQL</productname> installation.
</span>
作成する<span class="productname">PostgreSQL</span>ユーザの名前を指定します。
この名前は、その<span class="productname">PostgreSQL</span>インストレーションに存在するすべてのロールと異なるものでなければなりません。
</p></dd><dt><span class="term"><code class="option">-a <em class="replaceable"><code>role</code></em></code><br /></span><span class="term"><code class="option">--with-admin=<em class="replaceable"><code>role</code></em></code></span></dt><dd><p>
<span class="original">
Specifies an existing role that will be automatically added as a member of the new
role with admin option, giving it the right to grant membership in the
new role to others. Multiple existing roles can be specified by
writing multiple <option>-a</option> switches.
</span>
アドミンオプションを持つ新しいロールのメンバとして自動的に追加される既存のロールを指定します。
これにより、新しいロールのメンバ資格を他の人に付与する権利が与えられます。
<code class="option">-a</code>スイッチを複数記述することで、複数の既存のロールを指定できます。
</p></dd><dt><span class="term"><code class="option">-c <em class="replaceable"><code>number</code></em></code><br /></span><span class="term"><code class="option">--connection-limit=<em class="replaceable"><code>number</code></em></code></span></dt><dd><p>
<span class="original">
Set a maximum number of connections for the new user.
The default is to set no limit.
</span>
新しいユーザの最大接続数を設定します。
デフォルトでは無制限です。
</p></dd><dt><span class="term"><code class="option">-d</code><br /></span><span class="term"><code class="option">--createdb</code></span></dt><dd><p>
<span class="original">
The new user will be allowed to create databases.
</span>
新しいユーザに対してデータベースの作成を許可します。
</p></dd><dt><span class="term"><code class="option">-D</code><br /></span><span class="term"><code class="option">--no-createdb</code></span></dt><dd><p>
<span class="original">
The new user will not be allowed to create databases. This is the
default.
</span>
新しいユーザに対してデータベースの作成を禁止します。
これはデフォルトです。
</p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--echo</code></span></dt><dd><p>
<span class="original">
Echo the commands that <application>createuser</application> generates
and sends to the server.
</span>
<span class="application">createuser</span>が生成しサーバに送信するコマンドを出力します。
</p></dd><dt><span class="term"><code class="option">-E</code><br /></span><span class="term"><code class="option">--encrypted</code></span></dt><dd><p>
<span class="original">
This option is obsolete but still accepted for backward
compatibility.
</span>
このオプションは廃止されましたが、後方互換性のためにまだ受け付けられます。
</p></dd><dt><span class="term"><code class="option">-g <em class="replaceable"><code>role</code></em></code><br /></span><span class="term"><code class="option">--member-of=<em class="replaceable"><code>role</code></em></code><br /></span><span class="term"><code class="option">--role=<em class="replaceable"><code>role</code></em></code> (deprecated)</span></dt><dd><p>
<span class="original">
Specifies the new role should be automatically added as a member
of the specified existing role. Multiple existing roles can be
specified by writing multiple <option>-g</option> switches.
</span>
新しいロールが、指定された既存のロールのメンバとして自動的に追加されるように指定します。
<code class="option">-g</code>スイッチを複数記述することで、複数の既存のロールを指定できます。
</p></dd><dt><span class="term"><code class="option">-i</code><br /></span><span class="term"><code class="option">--inherit</code></span></dt><dd><p>
<span class="original">
The new role will automatically inherit privileges of roles
it is a member of.
This is the default.
</span>
新しいロールは自動的にメンバとして属するロールの権限を継承します。
これがデフォルトです。
</p></dd><dt><span class="term"><code class="option">-I</code><br /></span><span class="term"><code class="option">--no-inherit</code></span></dt><dd><p>
<span class="original">
The new role will not automatically inherit privileges of roles
it is a member of.
</span>
新しいロールは自動的にメンバとして属するロールの権限を継承しません。
</p></dd><dt><span class="term"><code class="option">--interactive</code></span></dt><dd><p>
<span class="original">
Prompt for the user name if none is specified on the command line, and
also prompt for whichever of the options
<option>-d</option>/<option>-D</option>,
<option>-r</option>/<option>-R</option>,
<option>-s</option>/<option>-S</option> is not specified on the command
line. (This was the default behavior up to PostgreSQL 9.1.)
</span>
ユーザ名がコマンドラインで指定されない場合、ユーザ名の入力を促し、更に
<code class="option">-d</code>/<code class="option">-D</code>、<code class="option">-r</code>/<code class="option">-R</code>、<code class="option">-s</code>/<code class="option">-S</code>オプションがコマンドラインで指定されない場合にはどちらにするか入力を促します。
(これはPostgreSQL 9.1までのデフォルトの動作でした。)
</p></dd><dt><span class="term"><code class="option">-l</code><br /></span><span class="term"><code class="option">--login</code></span></dt><dd><p>
<span class="original">
The new user will be allowed to log in (that is, the user name
can be used as the initial session user identifier).
This is the default.
</span>
新しいユーザに対してログインを許可します。
(つまり、このユーザ名をセッション起動時のユーザ識別子として使用することができます。)
これがデフォルトです。
</p></dd><dt><span class="term"><code class="option">-L</code><br /></span><span class="term"><code class="option">--no-login</code></span></dt><dd><p>
<span class="original">
The new user will not be allowed to log in.
(A role without login privilege is still useful as a means of
managing database permissions.)
</span>
新しいユーザに対してログインを禁止します。
(ログイン権限を持たないロールはデータベース権限管理という面で有意です。)
</p></dd><dt><span class="term"><code class="option">-m <em class="replaceable"><code>role</code></em></code><br /></span><span class="term"><code class="option">--with-member=<em class="replaceable"><code>role</code></em></code></span></dt><dd><p>
<span class="original">
Specifies an existing role that will be automatically
added as a member of the new role. Multiple existing roles can
be specified by writing multiple <option>-m</option> switches.
</span>
新しいロールのメンバとして自動的に追加される既存のロールを指定します。
<code class="option">-m</code>スイッチを複数記述することで、複数の既存のロールを指定できます。
</p></dd><dt><span class="term"><code class="option">-P</code><br /></span><span class="term"><code class="option">--pwprompt</code></span></dt><dd><p>
<span class="original">
If given, <application>createuser</application> will issue a prompt for
the password of the new user. This is not necessary if you do not plan
on using password authentication.
</span>
このオプションが指定されると、<span class="application">createuser</span>は新しいユーザのパスワードのプロンプトを表示します。
もしパスワード認証を使う予定がなければ、これは必要ありません。
</p></dd><dt><span class="term"><code class="option">-r</code><br /></span><span class="term"><code class="option">--createrole</code></span></dt><dd><p>
<span class="original">
The new user will be allowed to create, alter, drop, comment on,
change the security label for other roles; that is,
this user will have <literal>CREATEROLE</literal> privilege.
See <xref linkend="role-creation"/> for more details about what
capabilities are conferred by this privilege.
</span>
他のロールの作成、変更、削除、コメント付与、およびセキュリティラベルの変更を新しいユーザに対して許可します。つまり、このユーザは<code class="literal">CREATEROLE</code>権限を持つことになります。
この権限によって付与される機能の詳細については、<a class="xref" href="role-attributes.html#ROLE-CREATION">ロールの作成</a>を参照してください。
</p></dd><dt><span class="term"><code class="option">-R</code><br /></span><span class="term"><code class="option">--no-createrole</code></span></dt><dd><p>
<span class="original">
The new user will not be allowed to create new roles. This is the
default.
</span>
新しいユーザに対して新しいロールの作成を禁止します。
これはデフォルトです。
</p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--superuser</code></span></dt><dd><p>
<span class="original">
The new user will be a superuser.
</span>
新しいユーザはスーパーユーザになります。
</p></dd><dt><span class="term"><code class="option">-S</code><br /></span><span class="term"><code class="option">--no-superuser</code></span></dt><dd><p>
<span class="original">
The new user will not be a superuser. This is the default.
</span>
新しいユーザはスーパーユーザにはなりません。
これはデフォルトです。
</p></dd><dt><span class="term"><code class="option">-v <em class="replaceable"><code>timestamp</code></em></code><br /></span><span class="term"><code class="option">--valid-until=<em class="replaceable"><code>timestamp</code></em></code></span></dt><dd><p>
<span class="original">
Set a date and time after which the role's password is no longer valid.
The default is to set no password expiry date.
</span>
ロールのパスワードが有効でなくなる日時を設定します。
デフォルトはパスワードの有効期限を設定しません。
</p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
<span class="original">
Print the <application>createuser</application> version and exit.
</span>
<span class="application">createuser</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">--bypassrls</code></span></dt><dd><p>
<span class="original">
The new user will bypass every row-level security (RLS) policy.
</span>
新しいユーザは、すべての行レベルセキュリティ(RLS)ポリシーをバイパスします。
</p></dd><dt><span class="term"><code class="option">--no-bypassrls</code></span></dt><dd><p>
<span class="original">
The new user will not bypass row-level security (RLS) policies. This is
the default.
</span>
新しいユーザは、行レベルセキュリティ(RLS)ポリシーをバイパスしません。
これがデフォルトです。
</p></dd><dt><span class="term"><code class="option">--replication</code></span></dt><dd><p>
<span class="original">
The new user will have the <literal>REPLICATION</literal> privilege,
which is described more fully in the documentation for <xref
linkend="sql-createrole"/>.
</span>
新しいユーザは<code class="literal">REPLICATION</code>権限を持ちます。
この権限については<a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a>の文書で詳しく説明します。
</p></dd><dt><span class="term"><code class="option">--no-replication</code></span></dt><dd><p>
<span class="original">
The new user will not have the <literal>REPLICATION</literal>
privilege, which is described more fully in the documentation for <xref
linkend="sql-createrole"/>. This is the default.
</span>
新しいユーザは<code class="literal">REPLICATION</code>権限を持ちません。
この権限については<a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a>の文書で詳しく説明します。
これがデフォルトです。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<span class="original">
Show help about <application>createuser</application> command line
arguments, and exit.
</span>
<span class="application">createuser</span>のコマンドライン引数の使用方法を表示し、終了します。
</p></dd></dl></div><p>
</p><p>
<span class="original">
<application>createuser</application> also accepts the following
command-line arguments for connection parameters:
</span>
<span class="application">createuser</span>は、以下のコマンドライン引数も接続パラメータとして受け付けます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the host name of the machine on which the
server
is running. If the value begins with a slash, it is used
as the directory for the Unix domain socket.
</span>
サーバが稼働しているマシンのホスト名を指定します。
この値がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。
</p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the TCP port or local Unix domain socket file
extension on which the server
is listening for connections.
</span>
サーバが接続を監視するTCPポートもしくはUnixドメインソケットファイルの拡張子を指定します。
</p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
<span class="original">
User name to connect as (not the user name to create).
</span>
接続に使用するユーザ名です(作成するユーザの名前ではありません)。
</p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
<span class="original">
Never issue a password prompt. If the server requires
password authentication and a password is not available by
other means such as a <filename>.pgpass</filename> file, the
connection attempt will fail. This option can be useful in
batch jobs and scripts where no user is present to enter a
password.
</span>
パスワードの入力を促しません。
サーバがパスワード認証を必要とし、かつ、<code class="filename">.pgpass</code>ファイルなどの他の方法が利用できない場合、接続試行は失敗します。
バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。
</p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
<span class="original">
Force <application>createuser</application> to prompt for a
password (for connecting to the server, not for the
password of the new user).
</span>
<span class="application">createuser</span>は強制的にパスワード入力を促します。
(新しいユーザのパスワードではなく、サーバに接続するためのパスワードです)。
</p><p>
<span class="original">
This option is never essential, since
<application>createuser</application> will automatically prompt
for a password if the server demands password authentication.
However, <application>createuser</application> will waste a
connection attempt finding out that the server wants a password.
In some cases it is worth typing <option>-W</option> to avoid the extra
connection attempt.
</span>
サーバがパスワード認証を要求する場合<span class="application">createuser</span>は自動的にパスワード入力を促しますので、これが重要になることはありません。
しかし、<span class="application">createuser</span>は、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。
こうした余計な接続試行を防ぐために<code class="option">-W</code>の入力が有意となる場合もあります。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.4.5.7"><h2>環境</h2><span class="original">
<title>Environment</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>
<span class="original">
Default connection parameters
</span>
デフォルトの接続パラメータです。
</p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
<span class="original">
Specifies whether to use color in diagnostic messages. Possible values
are <literal>always</literal>, <literal>auto</literal> and
<literal>never</literal>.
</span>
診断メッセージで色を使うかどうかを指定します。
指定可能な値は<code class="literal">always</code>、<code class="literal">auto</code>、<code class="literal">never</code>です。
</p></dd></dl></div><p>
<span class="original">
This utility, like most other <productname>PostgreSQL</productname> utilities,
also uses the environment variables supported by <application>libpq</application>
(see <xref linkend="libpq-envars"/>).
</span>
このユーティリティは、他のほとんどの<span class="productname">PostgreSQL</span>ユーティリティと同様、<span class="application">libpq</span>がサポートする環境変数(<a class="xref" href="libpq-envars.html" title="32.15. 環境変数">32.15</a>参照)も使います。
</p></div><div class="refsect1" id="id-1.9.4.5.8"><h2>診断</h2><span class="original">
<title>Diagnostics</title>
</span><p>
<span class="original">
In case of difficulty, see <xref linkend="sql-createrole"/>
and <xref linkend="app-psql"/> for
discussions of potential problems and error messages.
The database server must be running at the
targeted host. Also, any default connection settings and environment
variables used by the <application>libpq</application> front-end
library will apply.
</span>
問題が発生した場合、考えられる原因とエラーメッセージの説明については、<a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a>と<a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a>を参照してください。
データベースサーバは対象ホストで稼働していなければなりません。
また、<span class="application">libpq</span>フロントエンドライブラリで使用される、デフォルトの接続設定と環境変数が適用されることを覚えておいてください。
</p></div><div class="refsect1" id="id-1.9.4.5.9"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p>
<span class="original">
To create a user <literal>joe</literal> on the default database
server:
</span>
デフォルトデータベースサーバ上に<code class="literal">joe</code>というユーザを作成します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>createuser joe</code></strong>
</pre><p>
</p><p>
<span class="original">
To create a user <literal>joe</literal> on the default database
server with prompting for some additional attributes:
</span>
デフォルトデータベースサーバ上に<code class="literal">joe</code>というユーザを一部の属性入力が促されるように作成します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>createuser --interactive joe</code></strong>
<code class="computeroutput">Shall the new role be a superuser? (y/n) </code><strong class="userinput"><code>n</code></strong>
<code class="computeroutput">Shall the new role be allowed to create databases? (y/n) </code><strong class="userinput"><code>n</code></strong>
<code class="computeroutput">Shall the new role be allowed to create more new roles? (y/n) </code><strong class="userinput"><code>n</code></strong>
</pre><p>
</p><p>
<span class="original">
To create the same user <literal>joe</literal> using the
server on host <literal>eden</literal>, port 5000, with attributes explicitly specified,
taking a look at the underlying command:
</span>
ホスト<code class="literal">eden</code>のポート番号5000上のサーバを使って上記と同じ<code class="literal">joe</code>というユーザを属性を明示的に指定して作成し、背後で実行される問い合わせを表示します。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>createuser -h eden -p 5000 -S -D -R -e joe</code></strong>
<code class="computeroutput">CREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;</code>
</pre><p>
</p><p>
<span class="original">
To create the user <literal>joe</literal> as a superuser,
and assign a password immediately:
</span>
<code class="literal">joe</code>というユーザをスーパーユーザとして作成します。作成時にパスワードを割り当てます。
</p><pre class="screen">
<code class="prompt">$ </code><strong class="userinput"><code>createuser -P -s -e joe</code></strong>
<code class="computeroutput">Enter password for new role: </code><strong class="userinput"><code>xyzzy</code></strong>
<code class="computeroutput">Enter it again: </code><strong class="userinput"><code>xyzzy</code></strong>
<code class="computeroutput">CREATE ROLE joe PASSWORD 'SCRAM-SHA-256$4096:44560wPMLfjqiAzyPDZ/eQ==$4CA054rZlSFEq8Z3FEhToBTa2X6KnWFxFkPwIbKoDe0=:L/nbSZRCjp6RhOhKK56GoR1zibCCSePKshCJ9lnl3yw=' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS;</code>
</pre><p>
<span class="original">
In the above example, the new password isn't actually echoed when typed,
but we show what was typed for clarity. As you see, the password is
encrypted before it is sent to the client.
</span>
上の例で、実際には入力した新しいパスワードは画面上に表示されませんが、分かりやすくするために記載しています。
上記の通りこのパスワードはクライアントに送信される前に暗号化されます。
</p></div><div class="refsect1" id="id-1.9.4.5.10"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><span class="simplelist"><a class="xref" href="app-dropuser.html" title="dropuser"><span class="refentrytitle"><span class="application">dropuser</span></span></a>, <a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a>, <a class="xref" href="runtime-config-client.html#GUC-CREATEROLE-SELF-GRANT">createrole_self_grant</a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-createdb.html" title="createdb">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-dropdb.html" title="dropdb">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">createdb</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">dropdb</span></td></tr></table></div></body></html>