PostgreSQL /etc/postgresql/11/main/pg_ident.conf

原始 📋 Debian 10 (Buster) 42 行

适用于

当前查看:
Debian 10 (Buster)
相同于:
其他版本:

详情

大小
42 行
MD5
f11c8332d3f444148c0b8ee83ec5fc6d
SHA256
297f466913f31ff2dcfceea5ccb1a03027db54d9a95270dfd8044cb0c5b016a8
/etc/postgresql/11/main/pg_ident.conf
# PostgreSQL User Name Maps
# =========================
#
# Refer to the PostgreSQL documentation, chapter "Client
# Authentication" for a complete description.  A short synopsis
# follows.
#
# This file controls PostgreSQL user name mapping.  It maps external
# user names to their corresponding PostgreSQL user names.  Records
# are of the form:
#
# MAPNAME  SYSTEM-USERNAME  PG-USERNAME
#
# (The uppercase quantities must be replaced by actual values.)
#
# MAPNAME is the (otherwise freely chosen) map name that was used in
# pg_hba.conf.  SYSTEM-USERNAME is the detected user name of the
# client.  PG-USERNAME is the requested PostgreSQL user name.  The
# existence of a record specifies that SYSTEM-USERNAME may connect as
# PG-USERNAME.
#
# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
# regular expression.  Optionally this can contain a capture (a
# parenthesized subexpression).  The substring matching the capture
# will be substituted for \1 (backslash-one) if present in
# PG-USERNAME.
#
# Multiple maps may be specified in this file and used by pg_hba.conf.
#
# No map names are defined in the default configuration.  If all
# system user names and PostgreSQL user names are the same, you don't
# need anything in this file.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can
# use "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME

复制粘贴

curl:
curl https://exampleconfig.com/api/v1/config/original/f11c8332d3f444148c0b8ee83ec5fc6d?hint=pg_ident.conf
wget:
wget -O pg_ident.conf https://exampleconfig.com/api/v1/config/original/f11c8332d3f444148c0b8ee83ec5fc6d?hint=pg_ident.conf

给 AI Agent 用

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/f11c8332d3f444148c0b8ee83ec5fc6d?hint=pg_ident.conf' /><config><app>PostgreSQL</app><os>Debian 10 (Buster)</os><location>/etc/postgresql/11/main/pg_ident.conf</location><lines>42</lines><md5>f11c8332d3f444148c0b8ee83ec5fc6d</md5><sha256>297f466913f31ff2dcfceea5ccb1a03027db54d9a95270dfd8044cb0c5b016a8</sha256></config></prompt>

粘贴到 Claude、ChatGPT 或任何 AI 助手里。

安装 PostgreSQL

Alpine Linux

sudo apk add postgresql

Debian

sudo apt update && sudo apt install postgresql

Red Hat Enterprise Linux

sudo yum install postgresql17-server

Ubuntu

sudo apt update && sudo apt install postgresql

文件位置

文件路径
/etc/postgresql/11/main/pg_ident.conf
目录
/etc/postgresql/11/main/
用途
系统级配置目录
说明
/etc/ 里的文件是系统级配置,影响所有用户。

FAQ

什么时候该用这个 pg_ident.conf?

用来恢复缺失的默认文件、确认发行版本带了什么,或拿你的 PostgreSQL config 做 diff。

怎么恢复 PostgreSQL 的默认配置?

下载文件,把 /etc/postgresql/11/main/pg_ident.conf 里的当前配置备份好,替换掉,然后 reload 或 restart PostgreSQL。

pg_ident.conf 适合直接上生产吗?

这是 Debian 10 (Buster) 的厂商默认配置,只能当基线。上生产前请检查安全和性能设置。

和其他 OS 版本有什么不同?

默认值会随发行版和版本变化,这份对应 Debian 10 (Buster)。

我可以用它来排查 PostgreSQL 吗?

可以。和你的配置做 diff 找出漂移,然后只恢复需要的段落。