Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

CreateProcessW failed error:2 #85

Open
sasagr opened this issue Jan 7, 2021 · 7 comments
Open

CreateProcessW failed error:2 #85

sasagr opened this issue Jan 7, 2021 · 7 comments

Comments

@sasagr
Copy link

sasagr commented Jan 7, 2021

Describe the bug
C:\Users\sasasa>ssh -o UserKnownHostsFile=/dev/null -o VisualHostKey=yes -oProxyCommand="cloudflared access ssh --hostname %h" -L 5901:localhost:5901 [email protected]
CreateProcessW failed error:2
posix_spawn: No such file or directory

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
@demotomohiro
Copy link
Owner

That error looks like SSH tried to run cloudflared but failed.
Did you download cloudflared and put it in a directory your PATH environment variable points?
If you installed cloudflared correctly, running cloudflared --help on console prints help message.

@sasagr
Copy link
Author

sasagr commented Jan 8, 2021

I m not sure I m understanding your point about PATH environment but that's what I did.
I downloaded the cloudfared.exe file. I created a config file in .ssh directory with the following text (with the path location of my cloudfare file):
Host *.trycloudflare.com
HostName %h
User root
Port 22
ProxyCommand <PUT_THE_ABSOLUTE_CLOUDFLARE_PATH_HERE> access ssh --hostname %h

I did this following an other tutorial about Argo Tunnel.
Your ssh command line seems to work fine if I omit the -oProxyCommand="cloudflared access ssh --hostname %h" part.
Pls guide me to fix it in order to run your command correctly

@demotomohiro
Copy link
Owner

You will find many web sites that explains what is PATH environment variable and how to set it by googling with "PATH environment variable windows".
remocolab prints ssh command with all ssh options that are required to connect to the server so that you don't need to edit config file.
And remocolab suppose your cloudflared.exe is in one of directories PATH environment variable contains.
But ssh options can be configured in both config file and command line parameters.
You can learn how to use ssh in following pages.
https://man.openbsd.org/ssh
https://man.openbsd.org/ssh_config

@Shuntw6096
Copy link

Shuntw6096 commented Jan 28, 2021

Hi, I have the same problem, also use Chrome on Windows 10, but I set PATH, it doesn't work.
url

Thanks

@demotomohiro
Copy link
Owner

It might be a bug of the Windows openSSH.
Please try full path to your cloudfared in ProxyCommand option.

https://stackoverflow.com/questions/65059250/ssh-and-scp-failed-with-createprocessw-failed-error2-posix-spawn-no-such-file
PowerShell/Win32-OpenSSH#1185

@Shuntw6096
Copy link

It might be a bug of the Windows openSSH.
Please try full path to your cloudfared in ProxyCommand option.

https://stackoverflow.com/questions/65059250/ssh-and-scp-failed-with-createprocessw-failed-error2-posix-spawn-no-such-file
PowerShell/Win32-OpenSSH#1185

It works, thanks.

@lmc19970711
Copy link

@Shuntw6096
Hello, I have also this problem, but I can not see the solution, can you help me solve. Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants