createuser Application createuser Create a new PostgreSQL user 1999-11-07 createuser [ options ] [ username ] 1999-11-07 Inputs -h, --host host Specifies the hostname of the machine on which the postmaster is running. -p, --port port Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the postmaster is listening for connections. -e, --echo Echo the queries that createdb generates and sends to the backend. -q, --quiet Do not display a response. -d, --createdb Allows the new user to create databases. -D, --no-createdb Forbids the new user to create databases. -a, --adduser Allows the new user to create other users. -A, --no-adduser Forbids the new user to create other users. -P, --pwprompt 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. username Specifies the name of the PostgreSQL user to be created. This name must be unique among all PostgreSQL users. You will be prompted for a name and other missing information if it is not specified on the command line. The options -h, -p, and -e, are passed on literally to . If you need the psql options -U and -W as well, you can uncomment the respective lines in the source. They are disabled by default because of the potential conceptual confusion between existing and new users. 1999-11-07 Outputs CREATE USER All is well. createuser: Creation of user "username" failed. Something went wrong. The user was not created. If there is an error condition, the backend error message will be displayed. See and for possibilities. 1998-11-07 Description createuser creates a new PostgreSQL user. Only users with usesuper set in the pg_shadow class can create new Postgres users. createuser is a shell script wrapper around the SQL command via the PostgreSQL interactive terminal . Thus, there is nothing special about creating users via this or other methods. This means that the psql must be found by the script and that a database server is running at the targeted host. Also, any default settings and environment variables available to psql and the libpq front-end library do apply. 1999-11-07 Usage To create a user joe on the default database server: $ createuser joe Is the new user allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER To create the same user joe using the postmaster on host eden, port 5000, avoiding the prompts and taking a look at the underlying query: $ createuser -p 5000 -h eden -D -A -e joe QUERY: CREATE USER "joe" NOCREATEDB NOCREATEUSER CREATE USER