---
name: "pg_enc"
section: "1"
platform: "linux"
package: "pgpool2"
version: "4.6.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_enc"
---

# pg\_enc(1)

AES256 password encryption utility

## NAME

pg\_enc - AES256 password encryption utility

## SYNOPSIS

**pg\_enc** \[*option*...\] *-p*

**pg\_enc** \[*option*...\] *password*

## DESCRIPTION

**pg\_enc** AES256 password encryption utility.

## OPTIONS

- **-k** *KEY\_FILE* **--key-file=***KEY\_FILE*

  Set the path to the encryption key file. Default is the .pgpoolkey file located in the users home directory, which can be overridden by the environment variable *PGPOOLKEYFILE*.

- **-K** *ENCRYPTION\_KEY* **--enc-key=***ENCRYPTION\_KEY*

  Encryption key to be used for encrypting database passwords.

- **-f** *CONFIG\_FILE* **--config-file=***CONFIG\_FILE*

  Specifies the pgpool.conf file.

- **-i** *INPUT\_FILE* **--input-file=***INPUT\_FILE*

  Specifies file containing username and password pairs.

- **-p** **--prompt**

  Prompt for database password using standard input.

- **-P** **--prompt-for-key**

  Prompt for encryption key using standard input.

- **-m** **--update-pass**

  Create encrypted password entry in the pool\_passwd file.

- **-u** *your\_username* **--username=***your\_username*

  Creates the pool\_passwd entry for the database user called your\_username.

- **-h** **--help**

  Prints the help for pg\_enc.

**Note**\

If you are providing the password as an argument to pg\_enc and the password contains a "$" character, you must escape it.

For example, if you want to use "ABC$123" as password,

```
pg_enc -m -f /path/to/pgpool.conf -u username ABC\$123
```

## EXAMPLE

Here is an example output:

```
    pg_enc -p
    db password: [your password]
```

or

```
   ./pg_enc foo
   trying to read key from file /home/pgpool/.pgpoolkey
   jglid1QRgiCl/vfhHUDyVA==
   pool_passwd string: AESjglid1QRgiCl/vfhHUDyVA==
```

pg\_enc can be used for pool\_passwd passwords with:

```
    pg_enc -m -f /path/to/pgpool.conf -u username -p
    db password: [your password]
```

which will add an entry for username with the password given.

To avoid password prompt or password in command parameter, pg\_enc can read user name:password pairs from file. It will add all user names and encrypted password to pool\_passwd authentication file.

```
    $ cat users.txt
    username1:secretpassword1
    username2:secretpassword2
    $ pg_enc -m -f /path/to/pgpool.conf -i users.txt
    trying to read key from file /home/pgpool/.pgpoolkey
    trying to read user:password pairs from file users.text
    $ cat /path/to/pool_passwd
    username1:AESrx5QdpGyW/+4CB80KWtwhg==
    username2:AESUAdohy7nCUhWliRI9WiYQA==
```
