Amit Jotwani

Amit Jotwani

Exporting Media from Ghost CMS hosted on Digital Ocean

Tinkering

I recently moved my website from Ghost to Hugo. Ghost provides a built-in export function for content in JSON format (found in Labs under Settings), but it doesn’t have a media library UI or a media export function. To work around this, I had to manually SSH into the server. In my case, I’m using a Digital Ocean droplet. This guide will help you SSH into your Digital Ocean droplet and transfer those zipped images to your local machine.


Prerequisites

  • IP address of the Digital Ocean droplet (You can find this in your DO dashboard)
  • SSH key pair (public and private). In my case, the SSH key was located at ~/.ssh/id_rsa.

Steps

1. SSH into the Droplet

Open your local terminal and SSH into the droplet:

ssh -i "~/.ssh/id_rsa" root@your.ip.address.here

2. Verify Image Directory

Navigate to the Ghost CMS image directory to see if the images are stored there:

cd /var/www/ghost/content/images/
ls

3. Create a Zip Archive (Optional)

To simplify the transfer, you can zip the image files:

cd /var/www/ghost/content/
tar -czvf images.tar.gz images/

4. Transfer Images to Local Machine

Note: Make sure you exit the SSH session first. The following command should be run locally, not on the server.

Secure-copy the images or compressed archive to your local machine:

scp -i "~/.ssh/id_rsa" root@your.ip.address.here:/var/www/ghost/content/images.tar.gz /path/to/local/folder

5. Unzip the Archive (Optional)

If you transferred a compressed archive, unzip it to access the images:

tar -xzvf /path/to/local/folder/images.tar.gz

Fin!