1

Environment:

Windows 10.0.21327 wsl2, ubuntu 20 LTS win32-openssh

Windows Openssh Default shell changed to: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShell

  • C:\WINDOWS\System32\wsl.exe

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShellCommandOption

  • -e

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShellEscapeArguments

  • 0

Problem: I am trying to ssh in from a remote ubuntu machine to the windows machine and run rsync commands in the bash shell which is set as default shell for open ssh in windows. This was working fine in wsl1 for me before but doesnt work for me now that i changed the .exe from bash.exe to wsl.exe.

As a test I run the following command and get the standard version and command line usage output from rsync: ssh user@192.168.1.100 rsync

When I add rsync arguments I get no output whereas I would expect the rsync version to be printed in my stdout (correct assumption?) :

ssh user@192.168.1.100 rsync --version

If I add the -t arugment I get output: ssh -t user@192.168.0.100 rsync --version

But I don't think I want to pass in -t as an option to ssh when i run real rsync commands because i think that rsync requires a non interactive login shell doesnt it?

If I try to run a real rsync command I always get the following error: Command: rsync -vihrtl --progress --delete --partial -e "ssh -i ~/.ssh/id_rsa" user@192.168.1.100:/mnt/k/Onedrive /misc-home-backup/misc-home-media

Error:

rsync error: error in rsync protocol data stream (code 12) at io.c(235) [Receiver=3.1.3]

If I just ssh in to the windows machine from ubuntu I get a normal bash shell prompt with no messages, newlines, or any other output. And I checked my ~/.bashrc file in wsl ubuntu, which i havent ever changed from its default config and one of the first entries in there is that a login shell will be silent with no output.


Question: I think that my problem is that with my openssh configuration on windows I can do: ssh user@host command But cant do: ssh user@host command arguments

How do I configure the DefaultShell registry entry for windows openssh to be able to pass in command line options?

user622130
  • 11
  • 2

1 Answers1

1

Depending on the DefaultShell and how the target executable operates, you may have to put your command in quotes, e.g.: ssh user@192.168.1.100 "rsync --version"

For troubleshooting purposes, you can also use ssh -tt to ensure that you're getting the command output, though this won't be necessary when you things are working properly.

Vic
  • 111
  • 1