How to copy files off a VM

Thanks @ignoramous. I think I’m stuck on ssh key issues, though I’m puzzled why ssh console works and scp doesn’t. When I run with -vvv, it sends my id_rsa public key, but returns receive packet: type 51, which I think means it rejected it. I have checked my permissions, and generated fresh keys, without luck. I’m probably missing something blindingly obvious…

Strange stuff.

Do you happen to run apps in multiple orgs? If so, this post may have some pointers: Fly-Builder can't connect to Docker - #5 by mhostetler

1 Like

Thanks for your help @ignoramous. I do, and I followed the instructions in that post, but no luck. fly doctor gives:

Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... Nope
Pinging WireGuard gateway (give us a sec)... PASSED

App specific checks for appname:
Checking that app has ip addresses allocated... PASSED
Checking AAAA record for appname.fly.dev... PASSED

Build checks for appname:
Checking docker context size (this may take little bit)... PASSED (92 MB)

I got it working!

I worked off Using rsync on an app instace, but it had the exact same instructions I’d tried before; however, in the course of things, I ran across two other commands that seemed to have done the trick.

These were the commands that were needed:

# In one terminal
flyctl proxy 10022:22
# In another, SSH in
fly ssh console
# install scp on the remote (alpine linux)
apk add openssh

These commands seemed to be necessary in order for flyctl ssh issue --agent to work:

ssh-agent bash
ssh-keygen -f "/home/USERNAME/.ssh/known_hosts" -R "[localhost]:10022"
flyctl ssh issue --agent

After that, I could use scp to copy files to and from the persistent volume:

# Backup ghost content
scp -r -P 10022 root@localhost:/var/lib/ghost/content/ .

# Restore relevant content
cd content/
scp -r -P 10022 images/ themes/ root@localhost:/var/lib/ghost/content/

Once I better understand why it worked this time, I’ll turn this into a proper tutorial for people who were as baffled as I was…

2 Likes

This article https://til.simonwillison.net/fly/scp really helps - a lot …

1 Like

Thank you. Works like a charm. Tested on Ubuntu (WSL).