SSH remote connection fails on Windows machines with PowerShell default shell
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-andor;)2>/dev/nullfor stderr redirection (PowerShell uses2>$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:
- Detect the remote shell during the probe phase and send PowerShell-compatible commands when appropriate
- Wrap commands in a way that works across both bash and PowerShell (e.g., explicitly invoking
bash -c "..."orpowershell -Command "...") - 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
- Set up a Windows 11 machine with OpenSSH Server (default PowerShell shell)
- Attempt to connect via Claude Code Desktop SSH remote connection
- Observe the
ParserErrorfrom PowerShell trying to parse bash syntax
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗