claude-code - 💡(How to fix) Fix [BUG] --dangerously-skip-permissions ignored when SSH_CONNECTION is set or TERM is empty

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Workaround if it helps anyone else hitting this:

claude() {
  env -u SSH_CONNECTION -u SSH_CLIENT -u SSH_TTY TERM="${TERM:-xterm-256color}" claude "$@"
}

Code Example

Bash command

   cd /tmp/repro ; echo test ; ls foo/ 2>/dev/null

 Compound command contains cd with output redirection - manual approval required to prevent path
 resolution bypass

 Do you want to proceed?
1. Yes
   2. No

---

# prompts:
claude --dangerously-skip-permissions

# does not prompt:
env -u SSH_CONNECTION -u SSH_CLIENT -u SSH_TTY TERM=xterm-256color claude --dangerously-skip-permissions

---

claude() {
  env -u SSH_CONNECTION -u SSH_CLIENT -u SSH_TTY TERM="${TERM:-xterm-256color}" claude "$@"
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The compound-command guard ("Compound command contains cd with output redirection - manual approval required to prevent path resolution bypass") still prompts even when launched with --dangerously-skip-permissions and skipDangerousModePermissionPrompt: true set in ~/.claude/settings.json

Same binary, same settings, same flag, same command, fires on a remote shell, silent on a local shell. The only difference is environment: the remote shell has SSH_CONNECTION set and TERM empty. Unsetting those makes the prompt stop.

Possibly related: #28240, #31523, #33990

What Should Happen?

--dangerously-skip-permissions should behave the same regardless of SSH_CONNECTION / TERM

Error Messages/Logs

Bash command

   cd /tmp/repro ; echo test ; ls foo/ 2>/dev/null

 Compound command contains cd with output redirection - manual approval required to prevent path
 resolution bypass

 Do you want to proceed?
1. Yes
   2. No

Steps to Reproduce

Same Claude Code binary, same ~/.claude/settings.json (with "skipDangerousModePermissionPrompt": true) on both machines.

Local shell (no SSH_*, TERM=xterm-256color):

  1. mkdir -p /tmp/repro
  2. claude --dangerously-skip-permissions
  3. Ask it to run: cd /tmp/repro ; echo test ; ls foo/ 2>/dev/null
  4. Runs silently.

Remote Linux shell over SSH (SSH_CONNECTION set, TERM empty):

  1. Same launch, same command.
  2. Prompt fires.

Isolating the env trigger on the same remote shell:

# prompts:
claude --dangerously-skip-permissions

# does not prompt:
env -u SSH_CONNECTION -u SSH_CLIENT -u SSH_TTY TERM=xterm-256color claude --dangerously-skip-permissions

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.150

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Workaround if it helps anyone else hitting this:

claude() {
  env -u SSH_CONNECTION -u SSH_CLIENT -u SSH_TTY TERM="${TERM:-xterm-256color}" claude "$@"
}

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING