Bash sandbox hardcodes /tmp, unusable on Termux/Android

Resolved 💬 3 comments Opened Mar 28, 2026 by kpkpkp Closed Mar 31, 2026

On Termux (Android), /tmp is on a read-only filesystem. The Bash tool sandbox unconditionally tries to mkdir /tmp/claude-{pid} before executing any command, which fails with EACCES: permission denied. This makes every single Bash call fail, even trivial ones like echo test.

Environment

  • Platform: Android (Termux)
  • Kernel: Linux 6.6.x-android15
  • Claude Code installed via npm in Termux
  • /tmp exists but is read-only — cannot chmod, rm, or symlink over it

What happens

Every Bash tool call fails before the actual command runs:

EACCES: permission denied, mkdir '/tmp/claude-10473'

What was tried

  • chmod 777 /tmp → Permission denied
  • ln -sf $PREFIX/tmp /tmp → Permission denied
  • rm -rf /tmp && ln -s ... → Read-only file system
  • TMPDIR=$PREFIX/tmp claude → Sandbox still uses /tmp, not $TMPDIR
  • Setting TMPDIR inside commands → Sandbox fails before command executes

Expected behavior

The sandbox should use os.tmpdir() or respect $TMPDIR instead of hardcoding /tmp. Termux sets $PREFIX/tmp as the writable temp directory.

Impact

All non-Bash tools (Read, Write, Edit, Glob, Grep, WebFetch, etc.) work fine. Only the Bash sandbox is affected, but this effectively disables shell access entirely on Termux.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗