Critical Issue: SCP file transfers fail when PowerShell is set as the default SSH shell.
scp localfile.txt windows-dev:
# Result: "scp: Received message too long 1347625027"
# Root Cause: PowerShell startup output interferes with SCP binary protocol- Cannot transfer files to/from Windows machine using standard SCP
- Limits automation capabilities and file management
- Forces manual file operations or workarounds
SMB Share Solution (for local dev machine):
- Windows machine IP:
192.168.4.225 - Username:
gshiv - Password:
gopal1sat - Can likely mount SMB share for direct file access
# Test SMB connectivity
smbclient -L //192.168.4.225 -U gshiv
# Mount Windows share (macOS/Linux)
mkdir -p /tmp/windows-share
mount -t smbfs //gshiv:gopal1sat@192.168.4.225/C$ /tmp/windows-share
# Alternative: Use smbclient for file transfers
smbclient //192.168.4.225/C$ -U gshiv -c "put localfile.txt remotefile.txt"# Test if SFTP works (uses SSH but different protocol)
sftp windows-dev
# Commands: put, get, ls, cd, etc.# Use Invoke-WebRequest for downloads
ssh windows-dev 'Invoke-WebRequest -Uri "http://source/file" -OutFile "C:\dest\file"'
# Use PowerShell copy commands
ssh windows-dev 'Copy-Item source destination'# Encode file to base64, transfer as text, decode on Windows
base64 localfile.txt > encoded.txt
ssh windows-dev 'certutil -decode encoded.txt decoded.txt'# Try PowerShell with no profile/logo
ssh windows-dev 'powershell -NoProfile -NoLogo -Command "Get-Host"'# Test setting PowerShell with specific parameters
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile"# Research SSH subsystem for file transfers
# Check if we can configure separate subsystem for SCP# Function to temporarily disable PowerShell for file transfers
function scp_to_windows() {
ssh windows-dev 'Remove-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell; Restart-Service sshd'
sleep 5
scp "$@"
ssh windows-dev 'Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "powershell.exe"; Restart-Service sshd'
}Create a new runbook: docs/runbooks/windows-ssh-file-transfers.md covering:
- All working file transfer methods
- Performance comparison
- Use case recommendations (SMB for bulk, SFTP for automation, etc.)
- Integration with existing PowerShell default shell setup
- Automated wrapper functions/scripts
Update both existing runbooks with:
- File transfer limitation warnings
- References to the file transfer solutions guide
- Recommended setup order if file transfers are critical
- SMB Share - Direct file system access, best for bulk transfers
- SFTP - Standard protocol, should work with PowerShell default
- PowerShell Remoting - Native Windows solution
- Wrapper Scripts - Automate shell switching for SCP
- Base64 Transfer - Reliable for small files
- Web-based Transfer - HTTP uploads/downloads
- SSH Subsystem Configuration - Custom SCP handling
- PowerShell SSH Module - Native PowerShell SSH client
- Alternative SSH Server - Different Windows SSH implementation
For each solution, test:
- Small text files (< 1KB)
- Binary files (images, executables)
- Large files (> 10MB)
- Bidirectional transfers (upload/download)
- Automation compatibility (scriptable)
- Performance compared to native SCP
- Reliable file transfer method that works with PowerShell default shell
- Documentation covering all viable approaches
- Automated tools for common file transfer scenarios
- Updated runbooks with file transfer guidance
- Performance acceptable for typical development workflows
- Test all solutions on the actual Windows dev machine (192.168.4.225)
- Prioritize solutions that don't require changing the PowerShell default shell
- Consider security implications of each transfer method
- Document performance characteristics and limitations
- Create helper functions/aliases for common operations
This should provide a comprehensive approach to solving the file transfer limitation while maintaining the benefits of PowerShell as the default SSH shell.