From c0d4d5473a09cb7f6682a84abaee29e087c5886c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 8 Sep 2001 15:24:00 +0000 Subject: Make the world somewhat safe for (not from) DELETE FROM pg_shadow; Assign the fixed user id 1 to the user created by initdb. A stand-alone backend will always set the user id to 1. (Consequently, the name of that user is no longer important.) In stand-alone mode, the user id 1 will have implicit superuser status, to allow repairs even if there are no users defined. Print a warning message when starting in stand-alone mode when no users are defined. Disallow dropping the current user and session user. Granting/revoking superuser status also grants/revokes usecatupd. (Previously, it would never grant it back. This could lead to "deadlocks".) CREATE USER and CREATE GROUP will start allocating user ids at 100 (unless explicitly specified), to prevent accidental creation of a superuser (plus some room for future extensions). --- doc/src/sgml/ref/initdb.sgml | 104 ++++++++++++++++++++++--------------- doc/src/sgml/ref/postgres-ref.sgml | 23 ++++---- doc/src/sgml/user-manag.sgml | 13 ++--- 3 files changed, 81 insertions(+), 59 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml index 9e94eccf76f..bab8dcf108f 100644 --- a/doc/src/sgml/ref/initdb.sgml +++ b/doc/src/sgml/ref/initdb.sgml @@ -1,5 +1,5 @@ @@ -9,7 +9,7 @@ Postgres documentation - initdb + initdb 1 Application @@ -25,12 +25,12 @@ Postgres documentation --pgdata -D - dbdir + directory - --sysid - -i - sysid + --username + -U + username --pwprompt-W @@ -49,11 +49,12 @@ Postgres documentation Description - initdb creates a new - Postgres database cluster or system. A - database cluster is a collection of databases that are managed by a - single postmaster. + initdb creates a new + PostgreSQL database cluster (or database + system). A database cluster is a collection of databases that are + managed by a single server instance. + Creating a database system consists of creating the directories in which the database data will live, generating the shared catalog tables @@ -66,26 +67,23 @@ Postgres documentation - You must not execute initdb as root; it must - be run by the Unix user account that will run the database server. - This is because you cannot run the database server as root either, but the - server needs to have access to the files initdb - creates. Furthermore, during the initialization phase, when there are no - users and no access controls installed, Postgres - will only connect with - the name of the current Unix user, so you must log in under the account - that will own the server process. + initdb must be run as the user that will own the + server process, because the server needs to have access to the + files and directories that initdb creates. + Since the server may not be run as root, you must not run + initdb as root either. (It will in fact refuse + to do so.) - Although initdb will attempt to create the + Although initdb will attempt to create the specified data directory, often it won't have permission to do so, since the parent of the desired data directory is often a root-owned directory. To set up an arrangement like this, create an empty data - directory as root, then use chown to hand over + directory as root, then use chown to hand over ownership of that directory to the database user account, then - su to become the database user, and - finally run initdb as the database user. + su to become the database user, and + finally run initdb as the database user. @@ -94,31 +92,32 @@ Postgres documentation - --pgdata=dbdir - -D dbdir + --pgdata=directory + -D directory - This option specifies where in the file system the database + This option specifies the directory where the database system should be stored. This is the only information required by - initdb, but you can avoid writing it by + initdb, but you can avoid writing it by setting the PGDATA environment variable, which can be convenient since the database server - (postmaster) can find the database + (postmaster) can find the database directory later by the same variable. - --sysid=sysid - -i sysid + --username=username + -U username - Selects the system id of the database superuser. This defaults - to the effective user id of the user running - initdb. It is really not important - what the superuser's sysid is, but one might choose to start - the numbering at some number like 1. + Selects the user name of the database superuser. This defaults + to the name of the effective user running + initdb. It is really not important what the + superuser's name is, but one might choose to keep the + customary name postgres, even if the operating + system user's name is different. @@ -128,7 +127,7 @@ Postgres documentation -W - Makes initdb prompt for a password + Makes initdb prompt for a password to give the database superuser. If you don't plan on using password authentication, this is not important. Otherwise you won't be able to use password authentication until you have a password @@ -162,7 +161,7 @@ Postgres documentation -L directory - Specifies where initdb should find + Specifies where initdb should find its input files to initialize the database system. This is normally not necessary. You will be told if you need to specify their location explicitly. @@ -175,7 +174,7 @@ Postgres documentation -n - By default, when initdb + By default, when initdb determines that an error prevented it from completely creating the database system, it removes any files it may have created before discovering that it can't finish the job. This option inhibits tidying-up and is @@ -191,7 +190,7 @@ Postgres documentation Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. - The bootstrap backend is the program initdb + The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of extremely boring output. @@ -205,11 +204,30 @@ Postgres documentation - See also + Environment + + + + PGDATA + + + + Specifies the directory where the database system is to be + stored; may be overridden using the option. + + + + + + + + See Also - - PostgreSQL Administrator's Guide - + + + + PostgreSQL Administrator's Guide + diff --git a/doc/src/sgml/ref/postgres-ref.sgml b/doc/src/sgml/ref/postgres-ref.sgml index fda88ae1d48..839a1e86a75 100644 --- a/doc/src/sgml/ref/postgres-ref.sgml +++ b/doc/src/sgml/ref/postgres-ref.sgml @@ -1,5 +1,5 @@ @@ -35,7 +35,7 @@ Postgres documentation -i -L -N - -o file-name + -o filename -O -P @@ -58,7 +58,7 @@ Postgres documentation -F -i -L - -o file-name + -o filename -O -p database -P @@ -103,9 +103,12 @@ Postgres documentation - When running a stand-alone backend the session user name will - automatically be set to the current effective Unix user name. If - that user does not exist the server will not start. + When running a stand-alone backend, the session user will be set to + the user with id 1. This user does not actually have to exist, so + a stand-alone backend can be used to manually recover from certain + kinds of accidental damage to the system catalogs. Implicit + superuser powers are granted to the user with id 1 in stand-alone + mode. @@ -157,14 +160,14 @@ Postgres documentation - -o file-name + -o filename Sends all debugging and error output to - OutputFile. + filename. If the backend is running under the postmaster, error messages are still sent to the frontend process as well as to - OutputFile, + filename, but debugging output is sent to the controlling tty of the postmaster (since only one file descriptor can be sent to an actual file). @@ -359,7 +362,7 @@ Postgres documentation - See also + See Also , diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index 12b4bfe9a50..0da598fbf43 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -34,12 +34,13 @@ CREATE USER name In order to bootstrap the database system, a freshly initialized - system always contains one predefined user. This user will have - the same name as the operating system user that initialized the - area (and is presumably being used as the user that runs the - server). Thus, often an initial user postgres - exists. In order to create more users you have to first connect as - this initial user. + system always contains one predefined user. This user will have the + fixed id 1, and by default (unless altered when running + initdb) it will have the same name as the + operating system user that initialized the area (and is presumably + being used as the user that runs the server). Customarily, this user + will be called postgres. In order to create more + users you have to first connect as this initial user. -- cgit v1.2.3