SSH remote connection fails on Windows machines with PowerShell default shell

Resolved 💬 2 comments Opened Mar 27, 2026 by CharryWu Closed Apr 26, 2026

Summary

Claude Code Desktop's SSH remote connection fails when connecting to a Windows machine where the default shell is PowerShell. The remote probe command uses Unix/bash syntax (&&, 2>/dev/null, etc.) that PowerShell cannot parse.

Error

Failed to probe remote machine: ParserError:
Line |
   1 | . ude/remote/server" && "$HOME/.claude/remote/server" --version 2>/dev/ .
     |                                                          ~~~~~~~
     | Unexpected token 'version' in expression or statement.

Root Cause

The probe command Claude Code sends over SSH assumes a POSIX-compatible shell (bash/zsh). On Windows machines running OpenSSH Server, the default shell is PowerShell, which does not support:

  • && for command chaining (PowerShell uses -and or ;)
  • 2>/dev/null for stderr redirection (PowerShell uses 2>$null)
  • -- prefixed flags in the same way

Current Workaround

Users must manually change the Windows machine's default SSH shell to Git Bash or WSL bash via registry edit:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force

This is not ideal as it changes the system-wide default shell for all SSH sessions.

Feature Request

Please add support for Windows PowerShell as a remote SSH shell. Possible approaches:

  1. Detect the remote shell during the probe phase and send PowerShell-compatible commands when appropriate
  2. Wrap commands in a way that works across both bash and PowerShell (e.g., explicitly invoking bash -c "..." or powershell -Command "...")
  3. Allow users to configure the remote shell in Claude Code settings (e.g., "ssh.remoteShell": "powershell")

Environment

  • Client: macOS (Claude Code Desktop)
  • Remote: Windows 11, OpenSSH Server, PowerShell 5.1+ as default shell
  • SSH config: Standard key-based auth, no special proxy or jump host

Reproduction

  1. Set up a Windows 11 machine with OpenSSH Server (default PowerShell shell)
  2. Attempt to connect via Claude Code Desktop SSH remote connection
  3. Observe the ParserError from PowerShell trying to parse bash syntax

View original on GitHub ↗

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