What is the name of the domain?
What is the error message?
the command is not recognized as an internal or external command, operable program or batch file.
What is the issue you’re encountering
Unable to establish remote connection because cloudflared is located in a directory that contains spaces.
What steps have you taken to resolve the issue?
I am using the OpenSSH client on Windows and trying to connect to a remote server using Cloudflare Tunnel’s executable. I must configure the server hostname in the SSH config file to match the hostname of the server that I am trying to connect to and perform additional operation. However, for whatever reason, the exec command in the config seems to be unable to recognize the command if the executable directory contains any spaces. I understand that paths with spaces need to be enclosed in quotation marks or use some escape characters when running in a terminal, but for whatever reason, nothing I tried seems to work in this case.
The code below shows how my SSH config file looks. Notice that the quotation mark enclosure works just fine for ProxyCommand, IdentityFile, and CertificateFile, but will not work for the exec command.
Match host vm.example.com exec “C:\Users\User Name\Project Directory\cloudflared.exe access ssh-gen --hostname %h”
HostName vm.example.com
ProxyCommand “C:\Users\User Name\Project Directory\cloudflared.exe” access ssh --hostname %h
IdentityFile “~/.cloudflared/vm.example.com-cf_key”
CertificateFile “~/.cloudflared/vm.example.com-cf_key-cert.pub”
I have tried multiple ways to escape this, such as using a the common escape character for double quotes, single quotes and such like below:
Match host vm.example.com exec “"C:\Users\User Name\Project Directory\cloudflared.exe" access ssh-gen --hostname %h”
Note that the config file (exec command) works perfectly fine when the directory contains no space. Any help in this regard will be greatly appreciated.
What are the steps to reproduce the issue?
In windows match, specify the path to the cloudflared.exe in the exec command. This path must contain spaces. Then ssh to the host using cloudflared.