How to copy files off a VM

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