{"Entry":{"collection":"guc","key":"unix_socket_directories","name":"unix_socket_directories","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Connections and Authentication / Connection Settings","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"9.2","status":"added","to":"9.3"},{"documentation_changed":true,"fields":{},"from":"12","status":"changed","to":"13"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"}],"content_hash":"c17309d70c490bdb8b308ce1d38e2350f819a47a3a79bb9c539aba783bcec152","context":"","default_changed_in":[],"default_history":[{"from":"9.3","to":"19","value":"/var/run/postgresql"}],"derived_content_hash":"ddf15edf5fb9c84d2222bfceab0442e1f42e270450d8433660a8b04df51e7412","editorial":{"advice":{"olap":"Use the same reviewed local-access boundary for analytical tools; add a directory or group only when its client and operating-system lifecycle are managed.","oltp":"Configure unix_socket_directories as one Unix-socket access policy: choose trusted directories, ownership, group membership, and modes, then test local poolers, monitoring, backup, and administration.","small":"Keep unix_socket_directories simple and least-privileged. A local socket avoids TCP overhead only marginally and should not be made world-accessible for convenience."},"mechanism":["unix_socket_directories sets the directories where Unix-domain sockets will be created. PostgreSQL creates one socket and lock file per listed directory at startup; a value beginning with @ selects an abstract namespace on supported systems.","unix_socket_directories is a POSTMASTER-context setting: PostgreSQL reads it during server startup, and a configuration reload or session SET cannot activate a new value.","Unix-socket reachability combines directory existence and traversal rights, socket group and mode, the server account, and client search paths; pg_hba.conf local records still authenticate users."],"pitfalls":["Expecting a reload or SET to activate unix_socket_directories, although it requires a controlled server restart.","Opening the socket mode broadly while overlooking directory traversal, group membership, and pg_hba.conf local authentication.","Adding a volatile or missing directory and preventing server startup or confusing local clients after restart.","Changing unix_socket_directories globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: unix_socket_directories","url":"https://www.postgresql.org/docs/19/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["listen_addresses","port","max_connections","reserved_connections","superuser_reserved_connections"],"summary":"unix_socket_directories is the PostgreSQL setting that defines the directories where Unix-domain sockets will be created."},"enumvals":[],"first_version":"9.3","group":"Connections and Authentication","group_slug":"connection","imported_at":"2026-09-27T17:57:32.24606+08:00","intro_commit":{"authored_at":"2012-08-10T17:26:44-04:00","discussion":[],"hash":"c9b0cbe98bd783e24a8c4d8d8ac472a494b81292","subject":"Support having multiple Unix-domain sockets per postmaster.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c9b0cbe98bd783e24a8c4d8d8ac472a494b81292"},"key":"unix_socket_directories","last_version":"20","max_val":"","min_val":"","name":"unix_socket_directories","position":439,"present_in":["9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:4b5dea5f967af90f36a0daead822e5e9cdeeb7dad25371da24ccb8220718f9c0","receipt_sha256":"31a4c2548538c7efd5aaa2795bbbec7023d3ce973cd556ea45933bb8ede6bc0e","repair":"wiki-repair-20261023"},"short_desc":"Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications.","short_desc_zh":"","source_rev":"wiki-repair-20261023:e6d0b6d5c67c42136dde2979a5422560378d5e5329464b44eafb68dd17253f7f","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"unix_socket_directories","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"unix_socket_directories","SourceRevision":"wiki-repair-20261023:e6d0b6d5c67c42136dde2979a5422560378d5e5329464b44eafb68dd17253f7f","Facts":{"boot_val":"/var/run/postgresql","category":"Connections and Authentication / Connection Settings","context":"postmaster","description":"Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. A value that starts with @ specifies that a Unix-domain socket in the abstract namespace should be created (currently supported on Linux only). In that case, this value does not specify a “directory” but a prefix from which the actual socket name is computed in the same manner as for the file-system namespace. While the abstract socket name prefix can be chosen freely, since it is not a file-system location, the convention is to nonetheless use file-system-like values such as @/tmp. The default value is normally /tmp, but that can be changed at build time. On Windows, the default is empty, which means no Unix-domain socket is created by default. This parameter can only be set at server start. In addition to the socket file itself, which is named .s.PGSQL.nnnn where nnnn is the server's port number, an ordinary file named .s.PGSQL.nnnn.lock will be created in each of the unix_socket_directories directories. Neither file should ever be removed manually. For sockets in the abstract namespace, no lock file is created.","description_zh":"指定服务器用于监听来自客户端应用的连接的 Unix 域套接字目录。通过列出用逗号分隔的多个目录可以建立多个套接字。项之间的空白被忽略，如果你需要在名字中包括空白或逗号，在目录名周围放上双引号。一个空值指定在任何 Unix 域套接字上都不监听，在这种情况中只能使用 TCP/IP 套接字来连接到服务器。 以 @ 开头的值表示应在抽象命名空间中创建 Unix 域套接字（目前仅在 Linux 上支持）。在这种情况下，此值不指定一个“目录”，而是一个前缀，从中计算实际套接字名称的方式与文件系统命名空间相同。虽然抽象套接字名称前缀可以自由选择（因为它不是文件系统位置），但惯例上仍然使用类似文件系统的值，例如 @/tmp。 默认值通常是 /tmp，但可以在构建时更改。在 Windows 上，默认值为空，这意味着默认不会创建 Unix 域套接字。这个参数只能在服务器启动时设置。 除了套接字文件本身（名为.s.PGSQL.nnnn，其中 nnnn 是服务器的端口号），一个名为.s.PGSQL.nnnn.lock 的普通文件会在每一个 unix_socket_directories 目录中被创建。任何一个都不应该被手工移除。对于抽象命名空间，没有锁文件被建立。","description_zh_html":"\u003cp\u003e\n        指定服务器用于监听来自客户端应用的连接的 Unix 域套接字目录。通过列出用逗号分隔的多个目录可以建立多个套接字。项之间的空白被忽略，如果你需要在名字中包括空白或逗号，在目录名周围放上双引号。一个空值指定在任何 Unix 域套接字上都不监听，在这种情况中只能使用 TCP/IP 套接字来连接到服务器。\n       \u003c/p\u003e\u003cp\u003e\n        以 \u003ccode class=\"literal\"\u003e@\u003c/code\u003e 开头的值表示应在抽象命名空间中创建 Unix 域套接字（目前仅在 Linux 上支持）。在这种情况下，此值不指定一个\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e目录\u003c/span\u003e”\u003c/span\u003e，而是一个前缀，从中计算实际套接字名称的方式与文件系统命名空间相同。虽然抽象套接字名称前缀可以自由选择（因为它不是文件系统位置），但惯例上仍然使用类似文件系统的值，例如\n        \u003ccode class=\"literal\"\u003e@/tmp\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        默认值通常是 \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e，但可以在构建时更改。在 Windows 上，默认值为空，这意味着默认不会创建 Unix 域套接字。这个参数只能在服务器启动时设置。\n       \u003c/p\u003e\u003cp\u003e\n        除了套接字文件本身（名为\u003ccode class=\"literal\"\u003e.s.PGSQL.\u003cem class=\"replaceable\"\u003e\u003ccode\u003ennnn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e，其中 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ennnn\u003c/code\u003e\u003c/em\u003e 是服务器的端口号），一个名为\u003ccode class=\"literal\"\u003e.s.PGSQL.\u003cem class=\"replaceable\"\u003e\u003ccode\u003ennnn\u003c/code\u003e\u003c/em\u003e.lock\u003c/code\u003e 的普通文件会在每一个 \u003ccode class=\"varname\"\u003eunix_socket_directories\u003c/code\u003e 目录中被创建。任何一个都不应该被手工移除。对于抽象命名空间，没有锁文件被建立。\n       \u003c/p\u003e","doc":{"anchor":"GUC-UNIX-SOCKET-DIRECTORIES","file":"runtime-config-connection.html","lang":"en","sha256":"567ba928f3e4c4783f548dc8a54f1e748f02bbe163924605f2132eb5b0da440d","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"unix_socket_directories","short_desc":"Sets the directories where Unix-domain sockets will be created.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-connection.html","sha256":"f4e5e4debc927cfa154bbdd71f3bf2eda8130ac3acace1109fe7d45ef2a3456b"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"string","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-UNIX-SOCKET-DIRECTORIES","file":"runtime-config-connection.html","lang":"en","sha256":"567ba928f3e4c4783f548dc8a54f1e748f02bbe163924605f2132eb5b0da440d","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"unix_socket_directories","SourceDatabase":"center","Version":"18","Locale":"en","Title":"unix_socket_directories","Summary":"Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. A value that starts with @ specifies that a Unix-domain socket in the abstract namespace should be created (currently supported on Linux only). In that case, this value does not specify a “directory” but a prefix from which the actual socket name is computed in the same manner as for the file-system namespace. While the abstract socket name prefix can be chosen freely, since it is not a file-system location, the convention is to nonetheless use file-system-like values such as @/tmp. The default value is normally /tmp, but that can be changed at build time. On Windows, the default is empty, which means no Unix-domain socket is created by default. This parameter can only be set at server start. In addition to the socket file itself, which is named .s.PGSQL.nnnn where nnnn is the server's port number, an ordinary file named .s.PGSQL.nnnn.lock will be created in each of the unix_socket_directories directories. Neither file should ever be removed manually. For sockets in the abstract namespace, no lock file is created.","BodyHTML":"\u003cp\u003eSpecifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. A value that starts with @ specifies that a Unix-domain socket in the abstract namespace should be created (currently supported on Linux only). In that case, this value does not specify a “directory” but a prefix from which the actual socket name is computed in the same manner as for the file-system namespace. While the abstract socket name prefix can be chosen freely, since it is not a file-system location, the convention is to nonetheless use file-system-like values such as @/tmp. The default value is normally /tmp, but that can be changed at build time. On Windows, the default is empty, which means no Unix-domain socket is created by default. This parameter can only be set at server start. In addition to the socket file itself, which is named .s.PGSQL.nnnn where nnnn is the server\u0026#39;s port number, an ordinary file named .s.PGSQL.nnnn.lock will be created in each of the unix_socket_directories directories. Neither file should ever be removed manually. For sockets in the abstract namespace, no lock file is created.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:e6d0b6d5c67c42136dde2979a5422560378d5e5329464b44eafb68dd17253f7f","ContentHash":"ce2a2c2e526a9c17ab39223b77f785e5b4aaab160a3c1aece3af914b2dfe5890","Payload":{"description":"Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. A value that starts with @ specifies that a Unix-domain socket in the abstract namespace should be created (currently supported on Linux only). In that case, this value does not specify a “directory” but a prefix from which the actual socket name is computed in the same manner as for the file-system namespace. While the abstract socket name prefix can be chosen freely, since it is not a file-system location, the convention is to nonetheless use file-system-like values such as @/tmp. The default value is normally /tmp, but that can be changed at build time. On Windows, the default is empty, which means no Unix-domain socket is created by default. This parameter can only be set at server start. In addition to the socket file itself, which is named .s.PGSQL.nnnn where nnnn is the server's port number, an ordinary file named .s.PGSQL.nnnn.lock will be created in each of the unix_socket_directories directories. Neither file should ever be removed manually. For sockets in the abstract namespace, no lock file is created."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
