Ghost-cli backup command generates error


Issue Summary
ghost backup command run from ghost-cli fails.

  • Explain roughly what’s wrong
  • When I run the ghost backup command from the ghost-cli, Backing up site fails with message A ProcessError occurred.
  • What did you expect to happen?
  • I expected a successful backup to be generated.

Steps to Reproduce

  1. Log in to server
  2. Switch user to ghost-mgr. sudo -i -u ghost-mgr
  3. Change directory to ghost. cd /var/www/ghost
  4. Run ghost backup command.

Setup information

Ghost Version
Ghost Version: 5.95.0
Ghost-CLI Version: 1.26.1

Node.js Version
v18.20.4

How did you install Ghost?
Digital Ocean marketplace - Ghost

Provide details of your host & operating system
Ubuntu, v22.04.5 LTS

Database type
mysql 8.0.39-0ubuntu0.22.04.1

Browser & OS version
Include if reporting frontend bugs.

Relevant log / error output

ghost-mgr@ourtwocentstravel:/var/www/ghost$ ghost backup

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


+ sudo systemctl is-active ghost_ourtwocentstravel-com
+ sudo mkdir -p /var/www/ghost/backup
? Enter your Ghost administrator email address ted.leroy@protonmail.com
? Enter your Ghost administrator password [hidden]
+ sudo cp /var/www/ghost/backup/content-from-v5.95.0-on-2024-10-04-14-20-57.json /var/www/ghost/content/data/content-from-v5.95.0-on-2024-10-04-14-20-57.json
+ sudo cp /var/www/ghost/backup/members-from-v5.95.0-on-2024-10-04-14-20-57.csv /var/www/ghost/content/data/members-from-v5.95.0-on-2024-10-04-14-20-57.csv
+ sudo chown -R ghost:ghost /var/www/ghost/content
✖ Backing up site
A ProcessError occurred.

Message: EACCES: permission denied, open '/var/www/ghost/content/data/content-from-v5.95.0-on-2024-10-04-14-20-57.json'
Exit code: EACCES

Shouldn’t the chown command be to ghost-mgr:ghost-mgr, not ghost:ghost?

sudo chown -R ghost:ghost /var/www/ghost/content should be
sudo chown -R ghost-mgr:ghost-mgr /var/www/ghost/content shouldn’t it?

Check your permissions and ownership. The content folder is owned by ghost.

Thank you mjw,

I think the permission denied error is due to the script doing sudo chown -R ghost:ghost /var/www/ghost/content instead of sudo chown -R ghost-mgr:ghost-mgr /var/www/ghost/content, is it not? This is why I’m submitting as a bug. I’m running the command as ghost-mgr, not as ghost. I’m wondering if the script hasn’t been updated to reflect use of ghost-mgr?

Sorry, mjw,

Are you saying the content folder is supposed to be owned by ghost, not ghost-mgr?

Kind regards,

Ted

I ran ghost doctor and corrected permissions as it recommended, then re-ran ghost backup and it ran clean. Thanks mjw!

Yes, ghost-mgr could be any user with permission to install and maintain Ghost. ghost owns content, and should not be confused with ghost-mgr.

Thanks so much for your help mjw!

I really try not to post stupid mistakes I make as bugs. Obviously I’m not always successful.

Sorry to have wasted your time on a silly mistake on my end.

Kind regards,

Ted

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