Skip to main content

Lightweight proot-based Linux sandboxes (Debian/Alpine) with no root required

Project description

prootbox

Lightweight proot-based Linux sandboxes (Debian/Alpine) with no root required.

  • No root / no setuid: pure proot, unprivileged.
  • Persistent machines you can create, attach to, and delete.
  • Ephemeral sandboxes that vanish on exit.
  • Detached sessions that keep a machine alive in the background.
  • Per-sandbox hostname (via unprivileged UTS namespace when available).
  • Zero runtime dependencies — pure stdlib, Python 3.6+.

All state lives in the current working directory at the time each call runs (proot-<arch>, base-<distro>/, machines/, sessions/), so different project folders stay isolated.

Install

pip install prootbox

CLI

prootbox                                  # show help
prootbox run                              # ephemeral debian
prootbox run --distro alpine

prootbox create mybox --distro alpine     # create persistent
prootbox attach mybox                     # open shell
prootbox list
prootbox delete mybox

prootbox session start sess1 mybox        # detached session on mybox
prootbox session attach sess1
prootbox session list
prootbox session stop sess1

python3 -m prootbox run                   # works as a module too

Python API

import prootbox as pb

# Ergonomic builder form
pb.create(pb.alpine("my-box"))
pb.create(pb.debian("dev"))
pb.attach("dev")
pb.delete(pb.alpine("my-box"))

pb.run(pb.ephemeral("alpine"))
pb.run()                                  # ephemeral debian

# Or direct form
pb.create("my-box", distro="alpine")
pb.run_ephemeral(distro="debian")

for m in pb.list_machines():
    print(m["name"], m["distro"])

# Sessions
pb.session_start("sess1", machine="dev")
pb.session_attach("sess1")
pb.session_stop("sess1")

Requirements

  • Linux (x86_64 or arm64)
  • unshare and cp in $PATH (standard on any distro)
  • Internet access on first run (downloads proot + rootfs tarballs)

How it works

On first use in a working directory, prootbox downloads a static proot binary and the requested distro's rootfs tarball, extracts it to base-<distro>/, and patches it (DNS, sudo, apt sandboxing). Machines are created with cp -alT (hardlinks) so they take almost no extra disk until written to.

License

MIT

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

prootbox-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

prootbox-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file prootbox-0.1.0.tar.gz.

File metadata

  • Download URL: prootbox-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for prootbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ca01752f7665e16612bbbaf11ebfb2003e370650eed56beb02e85dcf2a2a63f
MD5 8ad0817acb1d924541238b1720126315
BLAKE2b-256 bbfd5a0361a6fb6891761dc22252fb7cea8dca175f6a0ef2cd94ebdc39c3b32d

See more details on using hashes here.

File details

Details for the file prootbox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prootbox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for prootbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 175c8294679837135f71ee2376a628d441b0dde32cedb76cece32c70bf19e771
MD5 175aa2edc8c692d78cd5b96e563bd5ea
BLAKE2b-256 b462b3684aef876645441a49f2f19763b26aaca5bf10ca15ffdffde4539add0e

See more details on using hashes here.

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