Skip to content

Use user-writable default path for control socket#3551

Merged
benoitc merged 1 commit intomasterfrom
fix/control-socket-bsd-default
Mar 23, 2026
Merged

Use user-writable default path for control socket#3551
benoitc merged 1 commit intomasterfrom
fix/control-socket-bsd-default

Conversation

@benoitc
Copy link
Copy Markdown
Owner

@benoitc benoitc commented Mar 23, 2026

Summary

  • Fix control socket default path requiring root permissions on most systems
  • Use $XDG_RUNTIME_DIR/gunicorn.ctl if available, fall back to $HOME/.gunicorn/gunicorn.ctl
  • Auto-create parent directory with 0o700 permissions
  • Works on Linux, FreeBSD, OpenBSD, and macOS without elevated privileges

The previous default /run/gunicorn.ctl requires root permissions.
Now uses $XDG_RUNTIME_DIR/gunicorn.ctl if available, otherwise
$HOME/.gunicorn/gunicorn.ctl. This works on Linux, FreeBSD, OpenBSD,
and macOS without requiring elevated privileges.

- Add _get_default_control_socket() helper in config.py
- Create parent directory automatically with 0o700 permissions
- Update gunicornc CLI to use the same default path
- Add unit tests for path selection and directory creation
@benoitc benoitc force-pushed the fix/control-socket-bsd-default branch from 5602623 to e2a3a7a Compare March 23, 2026 16:48
@benoitc benoitc merged commit 0ad47db into master Mar 23, 2026
33 of 35 checks passed
@benoitc benoitc deleted the fix/control-socket-bsd-default branch March 23, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant