<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/shandbox-ufh6d7bu9" -->

---
title: shandbox | daily.dev
description: shandbox is a lightweight Linux sandboxing shell script built on unshare and nsenter, with no dependencies beyond a shell and util-linux. It creates a single...
canonical: https://daily.dev/posts/shandbox-ufh6d7bu9
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: shandbox | daily.dev
og:description: shandbox is a lightweight Linux sandboxing shell script built on unshare and nsenter, with no dependencies beyond a shell and util-linux. It creates a single...
og:url: https://daily.dev/posts/shandbox-ufh6d7bu9
og:image: https://api.daily.dev/og/posts/UfH6D7BU9.png
og:image:alt: shandbox
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# shandbox

**[Planet Igalia](https://daily.dev/sources/planet-igalia)** · 9 min read · 0 upvotes · 0 comments

## Summary

shandbox is a lightweight Linux sandboxing shell script built on unshare and nsenter, with no dependencies beyond a shell and util-linux. It creates a single shared sandbox environment mapping a host directory to /home/sandbox, isolating personal files while remaining low-friction for daily use. Users can start/stop the sandbox, add read-only or read-write bind mounts, run commands or open an interactive shell inside it, and share an ssh ControlMaster connection without exposing keys. It supports multiple independent sandboxes via SANDBOX_DIR, customizable init scripts, and requires a new user namespace plus util-linux 2.41+ (Ubuntu 25.10 or newer, since 25.04's util-linux is too old). Recent Ubuntu releases restrict unprivileged user namespaces via AppArmor, requiring a sysctl change or a custom AppArmor profile. The author contrasts it with more mature alternatives like Bubblewrap, Firecracker, and gVisor, and notes that recent local privilege escalation vulnerabilities are a reminder of the limits of namespace-based isolation.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://muxup.com/shandbox>

## Questions this post answers

### What is the minimum util-linux version required to run shandbox for Linux sandboxing?

util-linux 2.41 or newer is required for shandbox to work correctly, since it relies on unshare and nsenter functionality only available from that release onward. The earliest compatible Ubuntu release is 25.10, because Ubuntu 25.04 ships a util-linux version that is too old.

_developers evaluating lightweight sandboxing setups can track tool compatibility notes like this on daily.dev._

### How do I fix unprivileged user namespaces being blocked by AppArmor on recent Ubuntu releases?

Recent Ubuntu releases restrict unprivileged user namespace creation through AppArmor, blocking tools like shandbox until you adjust settings. You can either run 'sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0' for a non-persistent fix, or install a custom AppArmor profile at /etc/apparmor.d/ granting the userns capability to the specific binary, then reload apparmor.

_engineers troubleshooting AppArmor and namespace restrictions can follow fixes like this via daily.dev._

### How can I give a sandboxed process ssh access without copying my private keys into the sandbox?

You can expose an existing ssh ControlMaster connection into the sandbox without sharing key material by using a share-ssh style mechanism: it creates an ssh ControlMaster on the host and mounts the control socket into the sandbox home directory, valid for as long as that ssh process runs. Inside the sandbox, you connect using a named alias like 'ssh ext%buildbox'.

_developers designing isolated dev environments can find setup patterns like this through daily.dev._

## Similar posts on daily.dev

- [Easy Sandboxing on Linux with Bubblewrap](https://daily.dev/posts/easy-sandboxing-on-linux-with-bubblewrap-b5wpu6gga) · Lobsters · 0 upvotes · 0 comments
- [Sandboxing AI agents in Linux](https://daily.dev/posts/sandboxing-ai-agents-in-linux-8gbhps1vs) · Hacker News · 0 upvotes · 1 comments
- [Hardening with Firejail, Landlock, and bubblewrap](https://daily.dev/posts/hardening-with-firejail-landlock-and-bubblewrap-kmr8wfkw4) · Advanced Web Machinery · 0 upvotes · 0 comments
- [What is Sandbox Security?](https://daily.dev/posts/what-is-sandbox-security--z2gvetsfd) · Docker · 0 upvotes · 0 comments
- [Package Manager Sandboxing](https://daily.dev/posts/package-manager-sandboxing-rxvo2u0vl) · Andrew Nesbitt · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security)

[View this post on daily.dev](https://daily.dev/posts/shandbox-ufh6d7bu9)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"shandbox","url":"https://daily.dev/posts/shandbox-ufh6d7bu9","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/shandbox-ufh6d7bu9"},"datePublished":"2026-09-20T07:44:30.427Z","dateModified":"2026-09-20T07:50:11.334Z","description":"shandbox is a lightweight Linux sandboxing shell script built on unshare and nsenter, with no dependencies beyond a shell and util-linux. It creates a single...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d29a5697f0eb9e01ee31df369cfa928?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4d29a5697f0eb9e01ee31df369cfa928?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Planet Igalia","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Planet Igalia","logo":"https://media.daily.dev/image/upload/s--84VSWNwZ--/f_auto,q_auto/v1789890204/logos/planet-igalia?_a=BAMAMicg0","url":"https://daily.dev/sources/planet-igalia"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/shandbox-ufh6d7bu9","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Planet Igalia","item":"https://daily.dev/sources/planet-igalia"},{"@type":"ListItem","position":3,"name":"shandbox"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/shandbox-ufh6d7bu9#faq","mainEntity":[{"@type":"Question","name":"What is the minimum util-linux version required to run shandbox for Linux sandboxing?","acceptedAnswer":{"@type":"Answer","text":"util-linux 2.41 or newer is required for shandbox to work correctly, since it relies on unshare and nsenter functionality only available from that release onward. The earliest compatible Ubuntu release is 25.10, because Ubuntu 25.04 ships a util-linux version that is too old. developers evaluating lightweight sandboxing setups can track tool compatibility notes like this on daily.dev."}},{"@type":"Question","name":"How do I fix unprivileged user namespaces being blocked by AppArmor on recent Ubuntu releases?","acceptedAnswer":{"@type":"Answer","text":"Recent Ubuntu releases restrict unprivileged user namespace creation through AppArmor, blocking tools like shandbox until you adjust settings. You can either run 'sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0' for a non-persistent fix, or install a custom AppArmor profile at /etc/apparmor.d/ granting the userns capability to the specific binary, then reload apparmor. engineers troubleshooting AppArmor and namespace restrictions can follow fixes like this via daily.dev."}},{"@type":"Question","name":"How can I give a sandboxed process ssh access without copying my private keys into the sandbox?","acceptedAnswer":{"@type":"Answer","text":"You can expose an existing ssh ControlMaster connection into the sandbox without sharing key material by using a share-ssh style mechanism: it creates an ssh ControlMaster on the host and mounts the control socket into the sandbox home directory, valid for as long as that ssh process runs. Inside the sandbox, you connect using a named alias like 'ssh ext%buildbox'. developers designing isolated dev environments can find setup patterns like this through daily.dev."}}]}
```

