Skip to content

[FEATURE]: allow /tmp or $TMPDIR folder access option #4743

Closed as not planned

Description

@jiyeol-lee-kds

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Can we have an option to allow write access under /tmp or $TMPDIR to when they are outside of current project directory? Or we can also make the external_directory more extensible like the following

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "external_directory": {
      "env:$TMPDIR": "allow",
      "/tmp": "allow",
      "*": "allow",
    }
  }
}

What do you guys think?

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Nov 25, 2025
  2. github-actions commented on Nov 25, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if this is specifically about the feature to configure /tmp access via config options.

  3. jiyeol-lee-kds commented on Nov 25, 2025

    @jiyeol-lee-kds
    Author

    slightly similar request like #4667

  4. rekram1-node commented on Nov 25, 2025

    @rekram1-node
    Collaborator

    Yeah we need better more granular permissions setup

  5. self-assigned this
    on Nov 25, 2025
  6. camAtGitHub commented on Nov 30, 2025

    @camAtGitHub

    The environment variable BUN_TMPDIR might be what you're looking for. See this comment for reference: #4605 (comment).

    Setting BUN_TMPDIR to a directory on a partition mounted with the exec option helped resolve my "Failed to initialize OpenTUI render library: Failed to open library" error. Although you didn't specify your exact use case, it should function similarly to TMPDIR.

  7. Mattwmaster58 commented on Feb 8, 2026

    @Mattwmaster58

    from my reading, it definitely seems like #5386 is the same as this, and that issue has been fixed

  8. diegonix commented on Mar 8, 2026

    @diegonix

    Still an issue as of v1.2.21 (Mar 2026).
    My use case: a multi-agent writes a shared payload file to /tmp/ so that subagents can read it (avoids repeating large context inline). Subagents with "read": "allow" silently fail to read files under /tmp/ because external_directory defaults to "ask" — and subagents never surface the permission prompt.
    Workaround: explicitly setting "external_directory": { "/tmp/**": "allow" } per subagent in opencode.json. Works, but verbose.
    +1 for a first-class $TMPDIR / /tmp allow option — or at minimum, making external_directory: "ask" actually prompt for subagents instead of silently blocking.

  9. Nindaleth commented on Mar 9, 2026

    @Nindaleth
    Contributor

    This is how I set this:

    {
      "$schema": "https://opencode.ai/config.json",
      "permission": {
        "external_directory": {
          "*": "ask",
          "/tmp/**": "allow"
        }
      }
    }
    

    You could also try to add another entry like "{env:TMPDIR}/**": "allow", but I wouldn't do it... if that env variable is not set, it could have pretty unpleasant consequences in case it resolves to "/**".

  10. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  11. GottZ commented on Jun 16, 2026

    @GottZ

    just gave opencode a try..
    at least, please, improve the error message.

    $ opencode
    Error: Unexpected error
    
    An error occurred in Effect.tryPromise
    

    this is the failure that happens.. without any error message anywhere or log.
    mounting /tmp with noexec is hardening.. normies don't harden their systems..

    I literally have this in my .zshrc now:

    opencode() {
      local t="${XDG_CACHE_HOME:-$HOME/.cache}/opencode/tmp"
      mkdir -p "$t"
      BUN_TMPDIR="$t" command opencode "$@"
    }
  12. github-actions commented on Aug 16, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions