---
name: "pg_passwd"
section: "1"
platform: "linux"
package: "postgresql"
version: "7.2.1-2woody8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_passwd"
---

# pg\_passwd(1)

change a secondary PostgreSQL password file

## NAME

pg\_passwd - change a secondary PostgreSQL password file

## SYNOPSIS

**pg\_passwd** *filename*

## DESCRIPTION

**pg\_passwd** is a tool for manipulating flat text password files. These files can control client authentication of the PostgreSQL server. More information about setting up this authentication mechanism can be found in the *Administrator's Guide*.

The format of a text password file is one entry per line; the fields of each entry are separated by colons. The first field is the user name, the second field is the encrypted password. Other fields are ignored (to allow password files to be shared between applications that use similar formats). **pg\_passwd** enables users to interactively add entries to such a file, to alter passwords of existing entries, and to encrypt such passwords.

Supply the name of the password file as argument to the **pg\_passwd** command. To be used by PostgreSQL, the file needs to be located in the server's data directory, and the base name of the file needs to be specified in the *pg\_hba.conf* access control file.

```
$ pg_passwd /usr/local/pgsql/data/passwords
File "/usr/local/pgsql/data/passwords" does not exist.  Create? (y/n): y
Username: guest
Password:
Re-enter password:

```

where the Password: and Re-enter password: prompts require the same password input which is not displayed on the terminal. Note that the password is limited to eight useful characters by restrictions of the standard [crypt(3)](/crypt/3.md) library routine.

The original password file is renamed to *passwords.bk*.

To make use of this password file, put a line like the following in *pg\_hba.conf*:

```
host  mydb     133.65.96.250   255.255.255.255 password passwords

```

which would allow access to database mydb from host 133.65.96.250 using the passwords listed in the *passwords* file (and only to the users listed in that file).

**Note:** It is also useful to have entries in a password file with empty password fields. (This is different from an empty password.) Such entries allow you to restrict users who can access the system. These entries cannot be managed by **pg\_passwd**, but you can edit password files manually.

## SEE ALSO

*PostgreSQL Administrator's Guide*
