2

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 [email protected] 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 [email protected] rsync --version

If I add the -t arugment I get output: ssh -t [email protected] 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" [email protected]:/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?

1
  • Got the same issue, worked around it by falling back to C:\Windows\System32\bash.exe as the default shell (which still works fine in WLS2, as far as I can tell). Couldn't make it work with wsl.exe either :/ Commented Dec 9, 2022 at 18:23

1 Answer 1

1

Depending on the DefaultShell and how the target executable operates, you may have to put your command in quotes, e.g.: ssh [email protected] "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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.