createuser [options] [username]
Specifies the name of the PostgreSQL user to be created. This name must be unique among all PostgreSQL users.
Allows the new user to create other users.
Forbids the new user to create other users.
Allows the new user to create databases.
Forbids the new user to create databases.
Echo the queries that createdb generates and sends to the backend.
Specifies the hostname of the machine on which the postmaster is running. If host begins with a slash, it is used as the directory for the UNIX domain socket.
Allows you to pick a non-default user id for the new user. This is not necessary, but some people like it.
Specifies the Internet TCP/IP port or local UNIX domain socket file extension on which the postmaster is listening for connections.
If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using password authentication.
Do not display a response.
The options -h, -p, and -e, are passed on literally to psql. The psql options -U and -W are available as well, but their use can be confusing in this context.
createuser creates a new PostgreSQL user. Only users with usesuper set in the pg_shadow table can create new PostgreSQL users.
createuser is a shell script wrapper around the SQL command CREATE USER via the PostgreSQL interactive terminal psql. There is nothing special about creating users via this or other methods. psql must be found by the script and a database server must be running at the targeted host. Any default settings and environment variables available to psql and the libpq front-end library will apply.