{"Entry":{"collection":"auth","key":"peer","name":"peer","aliases":[],"metadata":{"aliases":[],"category":"Authentication and access control","content_hash":"845abdbd37cdd96ae1125e4660eddb2ec0314365050b622c9b9061f0236ebceb","derived_content_hash":"2e91aa35a80f1427333e83485d52dbf227e93ac142aa466e4bb51b489d589d57","imported_at":"2026-09-30T00:40:33.331784+08:00","name":"peer","name_zh":"","slug":"peer","summary":"Obtain the client's operating system user name from the operating system and check if it matches the requested database user name. This is only available for local connections. See Section 20.9 for details."}},"Definition":{"Collection":"auth","Key":"peer","SourceDatabase":"center","Version":"18","SourceTable":"authentication_method","SourceKey":"peer","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"aliases":[],"attributes":{"configuration":"pg_hba.conf","inventory":"User-visible source authentication method","method":"peer"},"comparison_data":{"documented_option_names":["map"],"method":"peer"},"comparison_hash":"45b9d1e2b3d7866cecb030ab10781f5e9a18a5ec1f244d9e811ee7a623c656ef","description":["Obtain the client's operating system user name from the operating system and check if it matches the requested database user name. This is only available for local connections. See Section 20.9 for details."],"description_zh":"认证方法 peer。","description_zh_html":"\u003cp\u003e认证方法 peer。\u003c/p\u003e\u003cdl\u003e\u003cdt\u003e索引访问方法\u003c/dt\u003e\u003cdd\u003e\u003ccode\u003epeer\u003c/code\u003e\u003c/dd\u003e\u003cdt\u003e配置\u003c/dt\u003e\u003cdd\u003e\u003ccode\u003epg_hba.conf\u003c/code\u003e\u003c/dd\u003e\u003c/dl\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cp\u003e\n    Peer 认证通过从内核获取客户端的操作系统用户名，并把它用作被允许的数据库用户名（可结合可选的用户名映射）来工作。这种方法只支持本地连接。\n   \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003epeer\u003c/code\u003e 支持下列配置选项：\n    \u003c/p\u003e\u003cp\u003e\n    Peer 认证只在提供 \u003ccode class=\"function\"\u003egetpeereid()\u003c/code\u003e 函数、\u003ccode class=\"symbol\"\u003eSO_PEERCRED\u003c/code\u003e 套接字参数或类似机制的操作系统上可用。目前这包括 \u003cspan class=\"systemitem\"\u003eLinux\u003c/span\u003e、大多数 \u003cspan class=\"systemitem\"\u003eBSD\u003c/span\u003e 变种（包括 \u003cspan class=\"systemitem\"\u003emacOS\u003c/span\u003e）以及 \u003cspan class=\"systemitem\"\u003eSolaris\u003c/span\u003e。\n   \u003c/p\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/auth-peer.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","facts":[{"label":"Method","value":"peer"},{"label":"Configuration","value":"pg_hba.conf"},{"label":"Inventory","value":"User-visible source authentication method"}],"facts_zh":[{"label":"方法","value":"peer"},{"label":"配置","value":"pg_hba.conf"},{"label":"清单","value":"用户可见的源码认证方法"}],"manual_html":"\u003cdiv class=\"sect1\" id=\"AUTH-PEER\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003e20.9. Peer Authentication \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.\u003c/p\u003e\n\u003cp\u003eThe following configuration options are supported for \u003ccode class=\"literal\"\u003epeer\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003emap\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows for mapping between system and database user names. See \u003ca class=\"xref\" href=\"/docs/18/auth-username-maps.html\" title=\"20.2. User Name Maps\"\u003eSection 20.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003ePeer authentication is only available on operating systems providing the \u003ccode class=\"function\"\u003egetpeereid()\u003c/code\u003e function, the \u003ccode class=\"symbol\"\u003eSO_PEERCRED\u003c/code\u003e socket parameter, or similar mechanisms. Currently that includes \u003cspan class=\"systemitem\"\u003eLinux\u003c/span\u003e, most flavors of \u003cspan class=\"systemitem\"\u003eBSD\u003c/span\u003e including \u003cspan class=\"systemitem\"\u003emacOS\u003c/span\u003e, and \u003cspan class=\"systemitem\"\u003eSolaris\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e","manual_path":"/docs/18/auth-peer.html","related":[],"release":{"catalog_fingerprint":"65c93d6048ef30e61023a84f9680fa6a92b1c383b7eb226741170077eb078502","channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"","sources":[{"label":"Matching PostgreSQL source archive","sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18 English manual","path":"auth-peer.html","sha256":"86d38705f6b31453e2191708e816d77363fbc13bb8112c4dff6da88869258eac","url":"/docs/18/auth-peer.html"},{"label":"PostgreSQL 18 English manual","path":"auth-pg-hba-conf.html","sha256":"6340d4abea2e0a3482afc31bcd1599a0fa10dc28a6f1e05d79ba831e2dd0b4c9","url":"/docs/18/auth-pg-hba-conf.html"}],"tables":[{"columns":[{"key":"name","label":"Option or term"},{"key":"description","label":"Meaning"}],"key":"method-options","rows":[{"description":"Allows for mapping between system and database user names. See Section 20.2 for details.","name":"map"}],"title":"Documented method options and alternatives"}],"tables_zh":[{"columns":[{"key":"name","label":"选项或术语"},{"key":"description","label":"含义"}],"key":"method-options","rows":[{"description":"允许在系统用户名和数据库用户名之间进行映射。详见 第 20.2 节 。","name":"map"}],"title":"手册中的方法选项与替代方式"}],"zh_from":{"authored_translation":"source-derived-structured-summary","body_sha256":"92019e257518dcc7186fc501ea3b27e963047e778befb528f4b09daef27c7976","kind":"same-version-chinese-manual-with-source-derived-structured-summary","manual":{"anchor":"","build_id":107,"extraction":"concept-introduction","fragment_sha256":"be5965a07959e1c4179ee82ad9a88e08516a152b09dc3adc9af2d4ed3ba8fcbc","locale":"zh-Hans","page_key":"auth-peer.html","source_hash":"f7d24dc0e9ba91d791b35b3fb2629992221e154b72f9ae88d79ac0d97f247d13","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/auth-peer.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}},"ManualEvidence":{"manual_path":"/docs/18/auth-peer.html","release":{"catalog_fingerprint":"65c93d6048ef30e61023a84f9680fa6a92b1c383b7eb226741170077eb078502","channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"label":"Matching PostgreSQL source archive","sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18 English manual","path":"auth-peer.html","sha256":"86d38705f6b31453e2191708e816d77363fbc13bb8112c4dff6da88869258eac","url":"/docs/18/auth-peer.html"},{"label":"PostgreSQL 18 English manual","path":"auth-pg-hba-conf.html","sha256":"6340d4abea2e0a3482afc31bcd1599a0fa10dc28a6f1e05d79ba831e2dd0b4c9","url":"/docs/18/auth-pg-hba-conf.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"auth","Key":"peer","SourceDatabase":"center","Version":"18","Locale":"en","Title":"peer","Summary":"Obtain the client's operating system user name from the operating system and check if it matches the requested database user name. This is only available for local connections. See Section 20.9 for details.","BodyHTML":"\u003cdiv id=\"AUTH-PEER\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2\u003e20.9. Peer Authentication \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe peer authentication method works by obtaining the client\u0026#39;s operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.\u003c/p\u003e\n\u003cp\u003eThe following configuration options are supported for \u003ccode\u003epeer\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003emap\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows for mapping between system and database user names. See \u003ca href=\"/docs/18/auth-username-maps.html\" rel=\"nofollow\"\u003eSection 20.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003ePeer authentication is only available on operating systems providing the \u003ccode\u003egetpeereid()\u003c/code\u003e function, the \u003ccode\u003eSO_PEERCRED\u003c/code\u003e socket parameter, or similar mechanisms. Currently that includes \u003cspan\u003eLinux\u003c/span\u003e, most flavors of \u003cspan\u003eBSD\u003c/span\u003e including \u003cspan\u003emacOS\u003c/span\u003e, and \u003cspan\u003eSolaris\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"d5c1af37d33880b0c13c1ee56f0d6fa70041971f502b9181298992d5f1d7595b","Payload":{"description":["Obtain the client's operating system user name from the operating system and check if it matches the requested database user name. This is only available for local connections. See Section 20.9 for details."],"manual_html":"\u003cdiv class=\"sect1\" id=\"AUTH-PEER\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003e20.9. Peer Authentication \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.\u003c/p\u003e\n\u003cp\u003eThe following configuration options are supported for \u003ccode class=\"literal\"\u003epeer\u003c/code\u003e:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003emap\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAllows for mapping between system and database user names. See \u003ca class=\"xref\" href=\"/docs/18/auth-username-maps.html\" title=\"20.2. User Name Maps\"\u003eSection 20.2\u003c/a\u003e for details.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003ePeer authentication is only available on operating systems providing the \u003ccode class=\"function\"\u003egetpeereid()\u003c/code\u003e function, the \u003ccode class=\"symbol\"\u003eSO_PEERCRED\u003c/code\u003e socket parameter, or similar mechanisms. Currently that includes \u003cspan class=\"systemitem\"\u003eLinux\u003c/span\u003e, most flavors of \u003cspan class=\"systemitem\"\u003eBSD\u003c/span\u003e including \u003cspan class=\"systemitem\"\u003emacOS\u003c/span\u003e, and \u003cspan class=\"systemitem\"\u003eSolaris\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"name","label":"Option or term"},{"key":"description","label":"Meaning"}],"key":"method-options","rows":[{"description":"Allows for mapping between system and database user names. See Section 20.2 for details.","name":"map"}],"title":"Documented method options and alternatives"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
