SCP through Cloudflare Tunnel

I’d like to use SCP to send a file to a server. The server’s SSH connection is protected by Cloudflare Tunnel.

I’ve set up my .ssh/config file as per the setup guide:

cloudflared access ssh-config --hostname vm.example.com --short-lived-cert

I can SSH into my server like so:

ssh vm.example.com

But if I try to use SCP, I get the authentication prompt webpage, then a normal SSH session opens instead of letting the file transfer run:

[email protected]:~$ scp file.txt vm.example.com:
failed to get app info: Head "https://vm.example.com": dial tcp: lookup vm.example.com: no such host
A browser window should have opened at the following URL:

https://vm.example.com/cdn-cgi/access/cli?edge_token_transfer=true&redirect_url=url&send_org_token=true&token=asdfasdf

If the browser failed to open, please visit the URL above directly in your browser.
Welcome to Ubuntu 22.04.1 LTS

Last login: Thu Aug 18 13:57:01 2022 from 127.0.0.1
[email protected]:~$

How can I transfer files to a server behind Cloudflare Tunnel?

If it supports it, you’d need to configure SCP to use the SSF Config file.

Those links seem to indicate it may be possible, but I haven’t tested. See also:

Went for the Github solution and it works perfectly. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.