Skip to content

unix_socket_permissions

unix_socket_permissions is the PostgreSQL setting that defines the access permissions of the Unix-domain socket.
Note

Fact — official short description: “Sets the access permissions of the Unix-domain socket.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuepostmaster
Requires a server restart
Unit , Value
Raw unit
Range , Value0511
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueConnections and Authentication / Connection Settings
Upstream classification
Latest boot value , Value511
511

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 511 511

How it works

unix_socket_permissions sets the chmod-style mode of filesystem Unix-domain sockets. Use a leading zero for octal notation. For a socket, only the write bit controls the ability to connect; read and execute bits do not provide meaningful additional socket access.

It is a POSTMASTER-context setting, so the mode changes only when sockets are recreated at server restart. Directory traversal permissions and unix_socket_group can form another local boundary, while pg_hba.conf local records still authenticate database users independently.

Abstract-namespace sockets have no filesystem permissions, so this setting is ignored for @-prefixed socket entries. Some operating systems also ignore socket modes entirely; the page must not present the mode as a portable replacement for directory permissions or pg_hba.conf.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Use 0770 or 0700 only when local operating-system membership is an intentional first boundary, and verify that directory permissions and pg_hba.conf still enforce the desired policy. The portable default 0777 can be acceptable when pg_hba.conf is authoritative.
OLAP Apply the same local policy to analytical tools. Do not weaken the mode to solve a missing group or directory deployment; repair the operating-system identity path instead.
Small nodes Choose the simplest mode supported by the platform and test it after restart. For abstract sockets or systems that ignore socket modes, enforce access through the directory choice where applicable and pg_hba.conf.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Writing decimal 770 instead of octal 0770 and creating an unintended numeric mode.
  • Expecting read or execute bits to control socket connection access; only the write bit matters.
  • Relying on the mode for abstract-namespace sockets or operating systems that ignore socket permissions.
  • Treating a restrictive socket mode as a substitute for pg_hba.conf authentication, role privileges, or directory traversal controls.

listen_addresses · port · max_connections · reserved_connections · superuser_reserved_connections · unix_socket_directories

References