Pegasus InfoCorp: Web site design and web software development company

PG_PASSWD (1)

Manipulate the flat password file

SYNOPSIS

    pg_passwd filename
    

DESCRIPTION

    pg_passwd is a tool to manipulate the flat password file functionality of Postgres. This style of password authentication is not required in an installation, but is one of several supported security mechanisms.

    Specify the password file in the same style of Ident authentication in $PGDATA/pg_hba.conf:

    host  unv     133.65.96.250   255.255.255.255 password passwd
    

    where the above line allows access from 133.65.96.250 using the passwords listed in $PGDATA/passwd. The format of the password file follows those of /etc/passwd and /etc/shadow. The first field is the user name, and the second field is the encrypted password. The rest is completely ignored. Thus the following three sample lines specify the same user and password pair:
    pg_guest:/nB7.w5Auq.BY:10031::::::
    pg_guest:/nB7.w5Auq.BY:93001:930::/home/guest:/bin/tcsh
    pg_guest:/nB7.w5Auq.BY:93001
    

    Supply the password file to the pg_passwd command. In the case described above, after changing the working directory to PGDATA, the following command execution specify the new password for pg_guest:

            % pg_passwd passwd
            Username: pg_guest
            Password:
            Re-enter password:
    

    where the Password: and Re-enter password: prompts require the same password input which are not displayed on the terminal. The original password file is renamed to passwd.bk.

    psql uses the -u option to invoke this style of authentication.

    The following lines show the sample usage of the option:

    % psql -h hyalos -u unv
    Username: pg_guest
    Password:
    Welcome to the POSTGRESQL interactive sql monitor:
      Please read the file COPYRIGHT for copyright terms of POSTGRESQL
       type \\? for help on slash commands
       type \\q to quit
       type \\g or terminate with semicolon to execute query
     You are currently connected to the database: unv
    unv=>
    

    Perl5 authentication uses the new style of the Pg.pm like this:

    $conn = Pg::connectdb("host=hyalos dbname=unv
                           user=pg_guest password=xxxxxxx");
    

    For more details, refer to src/interfaces/perl5/Pg.pm.

    Pg{tcl,tk}sh authentication uses the pg_connect command with the -conninfo option thusly:

    % set conn [pg_connect -conninfo \\\\
                "host=hyalos dbname=unv \\\\
                 user=pg_guest password=xxxxxxx "]
    

    You can list all of the keys for the option by executing the following command:
    % puts [ pg_conndefaults]