.\\" auto-generated by docbook2man-spec $Revision: 1.25 $ .TH "CREATEUSER" "1" "2002-11-22" "Application" "PostgreSQL Client Applications" .SH NAME createuser \- define a new PostgreSQL user account .SH SYNOPSIS .sp \fBcreateuser\fR\fR [ \fR\fB\fIoptions\fB\fR...\fB \fR\fR]\fR\fR [ \fR\fB\fIusername\fB \fR\fR]\fR .SH "DESCRIPTION" .PP \fBcreateuser\fR creates a new PostgreSQL user. Only superusers (users with usesuper set in the pg_shadow table) can create new PostgreSQL users, so \fBcreateuser\fR must be invoked by someone who can connect as a PostgreSQL superuser. .PP Being a superuser also implies the ability to bypass access permission checks within the database, so superuserdom should not be granted lightly. .PP \fBcreateuser\fR is a shell script wrapper around the SQL command CREATE USER [\fBcreate_user\fR(7)] via the PostgreSQL interactive terminal \fBpsql\fR(1). Thus, there is nothing special about creating users via this or other methods. This means that the \fBpsql\fR application must be found by the script and that a database server must be running at the targeted host. Also, any default settings and environment variables used by \fBpsql\fR and the \fBlibpq\fR front-end library will apply. .SH "OPTIONS" .PP \fBcreateuser\fR accepts the following command-line arguments: .TP \fB\fIusername\fB\fR Specifies the name of the PostgreSQL user to be created. This name must be unique among all PostgreSQL users. .TP \fB-a\fR .TP \fB--adduser\fR The new user is allowed to create other users. (Note: Actually, this makes the new user a \fIsuperuser\fR. The option is poorly named.) .TP \fB-A\fR .TP \fB--no-adduser\fR The new user is not allowed to create other users (i.e., the new user is a regular user, not a superuser). .TP \fB-d\fR .TP \fB--createdb\fR The new user is allowed to create databases. .TP \fB-D\fR .TP \fB--no-createdb\fR The new user is not allowed to create databases. .TP \fB-e\fR .TP \fB--echo\fR Echo the queries that \fBcreateuser\fR generates and sends to the server. .TP \fB-E\fR .TP \fB--encrypted\fR Encrypts the user's password stored in the database. If not specified, the default is used. .TP \fB-i \fIuid\fB\fR .TP \fB--sysid \fIuid\fB\fR Allows you to pick a non-default user ID for the new user. This is not necessary, but some people like it. .TP \fB-N\fR .TP \fB--unencrypted\fR Does not encrypt the user's password stored in the database. If not specified, the default is used. .TP \fB-P\fR .TP \fB--pwprompt\fR If given, \fBcreateuser\fR will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication. .TP \fB-q\fR .TP \fB--quiet\fR Do not display a response. .PP .PP You will be prompted for a name and other missing information if it is not specified on the command line. .PP \fBcreateuser\fR also accepts the following command-line arguments for connection parameters: .TP \fB-h \fIhost\fB\fR .TP \fB--host \fIhost\fB\fR Specifies the host name of the machine on which the server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. .TP \fB-p \fIport\fB\fR .TP \fB--port \fIport\fB\fR Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the server is listening for connections. .TP \fB-U \fIusername\fB\fR .TP \fB--username \fIusername\fB\fR User name to connect as (not the user name to create) .TP \fB-W\fR .TP \fB--password\fR Force password prompt (to connect to the server, not for the password of the new user). .PP .SH "ENVIRONMENT" .TP \fBPGHOST\fR .TP \fBPGPORT\fR .TP \fBPGUSER\fR Default connection parameters .SH "DIAGNOSTICS" .TP \fBCREATE USER\fR All is well. .TP \fBcreateuser: creation of user "\fIusername\fB" failed\fR Something went wrong. The user was not created. .PP If there is an error condition, the backend error message will be displayed. See CREATE USER [\fBcreate_user\fR(7)] and \fBpsql\fR(1) for possibilities. .PP .SH "EXAMPLES" .PP To create a user joe on the default database server: .sp .nf $ \fBcreateuser joe\fR Is the new user allowed to create databases? (y/n) \fBn\fR Shall the new user be allowed to create more new users? (y/n) \fBn\fR CREATE USER .sp .fi .PP To create the same user joe using the server on host eden, port 5000, avoiding the prompts and taking a look at the underlying query: .sp .nf $ \fBcreateuser -p 5000 -h eden -D -A -e joe\fR CREATE USER "joe" NOCREATEDB NOCREATEUSER CREATE USER .sp .fi .SH "SEE ALSO" \fBdropuser\fR(1), CREATE USER [\fBcreate_user\fR(7)]