DESTROYUSER(UNIX)

DESTROYUSER(UNIX)

destroydb Home Page User Commands Index df


NAME
       destroyuser  -  destroy  a  Postgres  user  and associated
       databases

SYNOPSIS
       destroyuser [-a system] [-h host] [-p port] [username]

DESCRIPTION
       Destroyuser destroys an existing  Postgres  user  and  the
       databases  for  which that user is database administrator.
       Only users with "usesuper" set in  the  "pg_shadow"  class
       can  destroy  new  Postgres  users.   As shipped, the user
       "postgres" can destroy users.

       Destroyuser is a shell script that invokes psql.  Hence, a
       postmaster  process must be running on the database server
       host before destroyuser is  executed.   In  addition,  the
       PGOPTION  and PGREALM environment variables will be passed
       on to psql and processed as described in psql(1).

       The optional argument username specifies the name  of  the
       Postgres  user  to  be  destroyed.   (The  invoker will be
       prompted for a name if none is specified  on  the  command
       line.)

       Destroyuser   understands   the   following   command-line
       options:

       -a system
            Specifies an authentication system system (see  pgin-
            tro(1))  to  use in connecting to the postmaster pro-
            cess.  This option no longer has any effect.

       -h host
            Specifies the hostname of the machine  on  which  the
            postmaster  is running.  Defaults to using local Unix
            domain sockets.

       -p port
            Specifies the TCP/IP port or local Unix domain socket
            file  extension  on which the postmaster is listening
            for connections.  Defaults to 5432, or the  value  of
            the PGPORT environment variable (if set).

INTERACTIVE QUESTIONS
       Once invoked with the above options, destroyuser will warn
       you about the databases that will be destroyed in the pro-
       cess  and  permit  you to abort the removal of the user if
       desired.

SEE ALSO
       createuser(1) psql(1) postmaster(1). 

DIAGNOSTICS
       Error: Failed to connect to backend (host=xxx, port=xxx)
            Destroyuser could not attach to the  postmaster  pro-
            cess on the specified host and port.  If you see this
            message, ensure that the postmaster is running on the
            proper  host  and  that you have specified the proper
            port.  If your site uses  an  authentication  system,
            ensure  that you have obtained the required authenti-
            cation credentials.

       user "username" is not in "pg_shadow"
            You do  not  have  a  valid  entry  in  the  relation
            "pg_shadow"  and  cannot do anything with Postgres at
            all; contact your Postgres site administrator.

       username cannot delete users.
            You do not have permission to delete  users;  contact
            your Postgres site administrator.

       user "username" does not exist
            The  user to be removed does not have an entry in the
            "pg_shadow" class.

       database access failed

       destroydb on dbname failed - exiting

       delete of user username was UNSUCCESSFUL
            An internal error occurred in  psql  or  the  backend
            server.   Contact your Postgres site administrator to
            ensure that the files and database entries associated
            with  the  user  and his/her associated databases are
            completely removed.

destroydb Home Page User Commands Index df