1

On wsl(ubuntu), I can do scp somefile ubuntu:somepath, and use tab completion for the somepath, as I use keys to ssh.

But I cant do this in reverse. On remote ubuntu I do scp somefile wsl:, and then press tab, it will show -bash: warning: command substitution: ignored null byte in input.

Config on remote ubuntu for host wsl is just using windows ip and windows username. key is added to C:\Users\username\.ssh\authorized_keys and I changed default shell to wsl in windows, using this microsoft guide. That registry key is now C:\Windows\System\wsl.exe. Plus, I can ssh into wsl from ubuntu without password.

Although I can go to wsl and do scp ubuntu:somefile somepath, but it's annoying to open another shell just for a command and then forget to close it.

  • Welcome to Super User! The link to the guide you mentioned is broken. Can you edit your question with the proper link? I have a feeling I know what you are doing, though. – NotTheDr01ds Feb 17 '22 at 14:27
  • Thanks for your warm welcome. I edited the link. – tothedistance Feb 18 '22 at 01:04
  • I planned to test this out myself before suggesting it, but I'm fairy confident that the "setting the shell" option is (at least part of) the problem here. This means that the key handling is being done on the Windows OpenSSH server side, and my understanding is that scp completion requires the agent to be able to communicate with the Linux end of things. I think that configuring ssh as I suggest in this answer will allow the "full chain" communication needed. But again, I haven't confirmed yet. – NotTheDr01ds Feb 19 '22 at 00:12
  • @NotTheDr01ds I will give it a try now – tothedistance Feb 19 '22 at 01:21
  • Cool - Let me know if you run into any troubles. – NotTheDr01ds Feb 19 '22 at 03:32
  • well, I configured wsl individual sshd. Apparently I can now scp to wsl. I am not confident about where the ProxyJump should be configured, so I am not using it. – tothedistance Feb 19 '22 at 03:53
  • If you are using -J successfully, then the ~/.ssh/config with ProxyJump isn't strictly necessary, just a nice-to-have to suppress the warnings you'll get in the future if you attempt a different localhost connection on a different port. -- Is the scp completion working for you now? – NotTheDr01ds Feb 19 '22 at 16:46
  • last time, I simply scp to wsl directly and I can use tab completion. But it occurred to me that I closed the firewall before. I guess using ProxyJump need only one 22 port open. So I will give it a try. – tothedistance Feb 22 '22 at 01:44
  • 1
    @NotTheDr01ds Yes, it works flawlessly. – tothedistance Feb 22 '22 at 02:01
  • That's correct - When using ProxyJump, you only need port 22 open. The connection from the Windows host to WSL (the actual "proxy jump") occurs "inside" the firewall. Good to hear it's working! – NotTheDr01ds Feb 22 '22 at 16:13
  • @NotTheDr01ds It would be of great help if you add how to start wsl sshd service when windows boot to your post. – tothedistance Mar 07 '22 at 06:56

0 Answers0