[BUG] --dangerously-skip-permissions ignored when SSH_CONNECTION is set or TERM is empty

Resolved 💬 2 comments Opened May 26, 2026 by brd6 Closed Jun 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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 "$@"
}

View original on GitHub ↗

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