Argo Tunnel RDP - only working after user is logged in


I am rather new to Cloudflare (and also to Linux) so please excuse me if I am asking for something too basic, I have browsed through the forum but couldn’t find a topic with an answer to my problem.

I have an Ubuntu server to which I connect remotely from a Windows 10 computer (via its native RDP client, I have XRDP installed in the server).

As I want to access the server from outside my local network (again via RDP) I followed the excellent tutorial available here:

I am facing a problem I can’t figure out how to solve.

The setup works perfectly if I first connect land log into my server over ssh (I use putty) locally, I mean using its local IP (192.168.1.X). I then start clouldflare in the client (C:\cloudflared\cloudflared.exe access rdp --hostname rdp.**.dk --url localhost:3390) and I can successfully RDP to the server using localhost:3390 (I have configured it in 3390 instead of the usual 3389).

However… if I don’t first establish that local ssh connection I get the following error:
ERR failed to connect to origin error=“websocket: bad handshake” originURL=**

Any idea of what could be causing this unexpected behavior?

Kind Regards,


In case it’d help someone running into the same issue, I have figured out the problem.

Some further testing made me realize that it wasn’t a local ssh connection the prerequisite to make it work, I simply had to log in after booting (either remotely from SSH or directly from the server), I am therefore changing the title of the topic.

The cloudflare tunnel is started automatically at boot, since it doesn’t work until the user is logged in I am assuming it is because the cloudflare files are located (yml, jason) in that user’s path.

I wonder if I could just move the /.cloudflared/ folder to a different location or it would just mess up the installation.

The cloudflared path should be /etc/cloudflared… I am not sure as I never tried RDP on Ubuntu, but for normal tunnels (SSH, HTTPS, etc.) it works as soon as it boots.

1 Like