Skip to main content

Do-Not-Disturb process enforcer — kill processes from unauthorized users on shared machines

Project description

dnd — Do Not Disturb

Process enforcer for shared machines. Monitors running processes and kills anything owned by users who aren't on the allowed list. Designed for honor-code reservation systems where some users don't follow the rules.

Quick start

No install needed — run directly with uvx:

# Allow everyone by default, block specific users:
uvx dnd-daemon allow '*'
uvx dnd-daemon block debopman

# Start the daemon (foreground, for testing):
uvx dnd-daemon run --dry-run

# Start for real:
uvx dnd-daemon run

Install

For persistent use, install globally with uv:

uv tool install dnd-daemon

Then use dnd directly:

dnd allow '*'
dnd block debopman
dnd run

Alternatively, install with pip:

pip install dnd-daemon

Commands

Command Description
dnd run Start the enforcement daemon
dnd allow <users...> Add users to the allowed list (also unblocks them)
dnd block <users...> Add users to the blocked list (also removes from allowed)
dnd list Show current allowed and blocked users
dnd install Install as a systemd service (requires sudo)
dnd uninstall Remove the systemd service (requires sudo)
dnd status Show systemd service status

dnd run options

  • --dry-run — log what would be killed without actually killing
  • --daemon — fork into background
  • --interval N — seconds between scans (default: 10)
  • --verbose — debug-level logging

Wildcards

Use * in the allowed list to allow everyone by default. The blocked list always takes priority over the wildcard:

dnd allow '*'       # everyone is allowed
dnd block baduser   # ...except baduser

Configuration

User lists are stored in ~/.cache/dnd/:

~/.cache/dnd/
  allowed_users.txt
  blocked_users.txt
  dnd.log

Override with --allow-config and --block-config:

dnd --allow-config /path/to/allowed.txt list

Systemd service

sudo dnd install    # creates, enables, and starts the service
sudo dnd uninstall  # stops, disables, and removes the service
dnd status          # show service status

The service runs as the installing user with CAP_KILL for permission to terminate other users' processes. Config changes via dnd allow / dnd block are automatically picked up (the daemon reloads on SIGHUP).

How it works

  1. Scans /proc every 10 seconds for all running processes
  2. Skips system/service accounts (UID <= 999, known service names)
  3. Checks each remaining process owner against the allowed/blocked lists
  4. Sends SIGTERM, waits 5 seconds, then SIGKILL if still alive

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dnd_daemon-0.0.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dnd_daemon-0.0.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file dnd_daemon-0.0.1.tar.gz.

File metadata

  • Download URL: dnd_daemon-0.0.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnd_daemon-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3e1f3fc260f8de6419d4f6de1f9f63f2034368cdc424ccb021c3b34039938c78
MD5 dd3f3d5d7d7929169f737ef18f51e353
BLAKE2b-256 66e423bf03825212b4e43d0372063a000f51875c8d701df51f862a8b47d43ef1

See more details on using hashes here.

Provenance

The following attestation bundles were made for dnd_daemon-0.0.1.tar.gz:

Publisher: publish.yml on AgrawalAmey/dnd-daemon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dnd_daemon-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dnd_daemon-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dnd_daemon-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d51935ee41ccc836c2ec6b8bfc58ba10e2692085f31520808bc70404fe0efbf
MD5 04cb27039f923ae8bcd8ae5c8cba8af9
BLAKE2b-256 c3d8d5f6c29464e24ef6f3564b2c749582fa3334fcad285c63294a7f587adedb

See more details on using hashes here.

Provenance

The following attestation bundles were made for dnd_daemon-0.0.1-py3-none-any.whl:

Publisher: publish.yml on AgrawalAmey/dnd-daemon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page