Multi-user permission conflicts with /tmp/claude-*-cwd files

Resolved 💬 9 comments Opened Dec 3, 2025 by ihanikos Closed Feb 28, 2026

Multi-user permission conflicts with /tmp/claude-*-cwd files

What's Wrong?

On shared Linux servers with multiple users running Claude Code, permission denied errors occur when accessing /tmp/claude-*-cwd files owned by other users.

Claude Code creates files like /tmp/claude-XXXX-cwd to track the current working directory for bash sessions. The problem is that Claude Code appears to iterate through or check files matching this prefix pattern, not just its own session's file. When it encounters a file owned by another user, it fails with permission denied.

What Should Happen?

Claude Code should either:

  1. Namespace temp files by UID (e.g., /tmp/claude-$UID-$ID-cwd or use a per-user directory like /tmp/claude-$UID/)
  2. Only access its own session's file, not iterate over all matching files
  3. Use $TMPDIR or $XDG_RUNTIME_DIR which are typically per-user

Error Messages/Logs

permission denied: /tmp/claude-4551-cwd

(File owned by another user on the same server)

Steps to Reproduce

  1. Have two different user accounts on the same Linux server
  2. User A runs Claude Code, which creates /tmp/claude-XXXX-cwd files
  3. User B runs Claude Code
  4. User B gets permission denied errors when Claude Code tries to access User A's files

Environment

  • Claude Code Version: 2.0.56
  • Platform: Anthropic API
  • Operating System: Oracle Linux (RHEL-compatible), kernel 6.8.0-1016-oracle
  • Terminal/Shell: Standard terminal/zsh

Is this a regression?

I don't know - this may have always been an issue on multi-user systems.

Additional Information

Example of accumulated files from multiple users on a shared server:

-rw-rw-r-- 1 cao        cao          21 Nov 30 11:57 /tmp/claude-0004-cwd
-rw-rw-r-- 1 claudecode claudecode   32 Nov  2 15:54 /tmp/claude-0019-cwd
-rw-rw-r-- 1 marko      marko        32 Nov 10 19:50 /tmp/claude-0031-cwd
...

There are hundreds of these files accumulating. Note: #8856 tracks the separate issue of these files never being cleaned up.

View original on GitHub ↗

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