version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
CREATEUSER |
|
|
2 |
!!!CREATEUSER |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
USAGE |
|
|
7 |
---- |
|
|
8 |
!!NAME |
|
|
9 |
|
|
|
10 |
|
|
|
11 |
createuser - define a new PostgreSQL user account |
|
|
12 |
!!SYNOPSIS |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
__createuser__ [[ ''options''... ] [[ ''username'' |
|
|
16 |
] |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__INPUTS__ |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__-h, --host__ ''host'' |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
Specifies the host name of the machine on which the server |
|
|
26 |
is running. If host begins with a slash, it is used as the |
|
|
27 |
directory for the Unix domain socket. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
__-p, --port__ ''port'' |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
Specifies the Internet TCP/IP port or local Unix domain |
|
|
34 |
socket file extension on which the server is listening for |
|
|
35 |
connections. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
__-e, --echo__ |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
Echo the queries that __createuser__ generates and sends |
|
|
42 |
to the server. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
__-q, --quiet__ |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
Do not display a response. |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
__-d, --createdb__ |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
The new user is allowed to create databases. |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
__-D, --no-createdb__ |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
The new user is not allowed to create |
|
|
61 |
databases. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
__-a, --adduser__ |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
The new user is allowed to create other users. (Note: |
|
|
68 |
actually, this makes the new user a ''superuser''. The |
|
|
69 |
option is poorly named.) |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
__-A, --no-adduser__ |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
The new user is not allowed to create other users (i.e., the |
|
|
76 |
new user is a regular user not a superuser). |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
__-P, --pwprompt__ |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
If given, __createuser__ will issue a prompt for the |
|
|
83 |
password of the new user. This is not necessary if you do |
|
|
84 |
not plan on using password authentication. |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
__-i, --sysid__ ''uid'' |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
Allows you to pick a non-default user id for the new user. |
|
|
91 |
This is not necessary, but some people like it. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
__-E, --encrypted__ |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Encrypts the user's password stored in the database. If not |
|
|
98 |
specified, the default is used. |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
__-N, --unencrypted__ |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
Does not encrypt the user's password stored in the database. |
|
|
105 |
If not specified, the default is used. |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
''username'' |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
Specifies the name of the PostgreSQL user to be created. |
|
|
112 |
This name must be unique among all PostgreSQL |
|
|
113 |
users. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
You will be prompted for a name and other missing |
|
|
117 |
information if it is not specified on the command |
|
|
118 |
line. |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
The options -h, -p, and -e, are passed on literally to |
|
|
122 |
psql(1). The __psql__ options -U and -W are |
|
|
123 |
available as well, but their use can be confusing in this |
|
|
124 |
context. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
__OUTPUTS__ |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
__CREATE USER__ |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
All is well. |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
__createuser: creation of user |
|
|
137 |
__''username''____ |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
Something went wrong. The user was not created. |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
If there is an error condition, the backend error message |
|
|
144 |
will be displayed. See CREATE USER [[__create_user__(l)] |
|
|
145 |
and psql(1) for possibilities. |
|
|
146 |
!!DESCRIPTION |
|
|
147 |
|
|
|
148 |
|
|
|
149 |
__createuser__ creates a new PostgreSQL user. Only |
|
|
150 |
superusers (users with usesuper set in the pg_shadow table) |
|
|
151 |
can create new PostgreSQL users, so __createuser__ must |
|
|
152 |
be invoked by someone who is a PostgreSQL |
|
|
153 |
superuser. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
Being a superuser also implies the ability to bypass access |
|
|
157 |
permission checks within the database, so superuser-dom |
|
|
158 |
should not be granted lightly. |
|
|
159 |
|
|
|
160 |
|
|
|
161 |
__createuser__ is a shell script wrapper around the SQL |
|
|
162 |
command CREATE USER [[__create_user__(l)] via the |
|
|
163 |
PostgreSQL interactive terminal psql(1). Thus, there |
|
|
164 |
is nothing special about creating users via this or other |
|
|
165 |
methods. This means that the __psql__ application must be |
|
|
166 |
found by the script and that a database server must be |
|
|
167 |
running at the targeted host. Also, any default settings and |
|
|
168 |
environment variables used by __psql__ and the |
|
|
169 |
__libpq__ front-end library will apply. |
|
|
170 |
!!USAGE |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
To create a user joe on the default database |
|
|
174 |
server: |
|
|
175 |
|
|
|
176 |
|
|
|
177 |
$ __createuser joe |
|
|
178 |
__Is the new user allowed to create databases? (y/n) __n |
|
|
179 |
__Shall the new user be allowed to create more new users? (y/n) __n |
|
|
180 |
__CREATE USER |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
To create the same user joe using the server on host eden, |
|
|
184 |
port 5000, avoiding the prompts and taking a look at the |
|
|
185 |
underlying query: |
|
|
186 |
|
|
|
187 |
|
|
|
188 |
$ __createuser -p 5000 -h eden -D -A -e joe |
|
|
189 |
__CREATE USER |
|
|
190 |
__ |
|
|
191 |
---- |