Ghost backup command - HTTPError: Response code 403 (Forbidden)

When I try to run ghost backup

I got error:

Debug Information:
    OS: Ubuntu, v20.04.5 LTS
    Node Version: v16.18.0
    Ghost Version: 5.22.10
    Ghost-CLI Version: 1.23.1
    Environment: production
    Command: 'ghost backup'
An error occurred.
Message: 'Response code 403 (Forbidden)'

Stack: HTTPError: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/usr/lib/node_modules/ghost-cli/node_modules/got/source/as-promise.js:74:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Path: /ghost/api/admin/authentication/setup/

On the same server I run the same command for different ghost installation - successfully.

For the first site I was asked for ghost admin user and pass.
For the error one - no user or pass were asked.

Is it possible to enter new user and pass with ghost backup command?

I didn’t find any doc or info:

Run ghost doctor, and check for file permissions.

1 Like

I’ve run ghost doctor - no problems were detected.

I did restart on the ghost and the server.
even I’ve changed the password for the admin - to be the same as the first ghost installation.

The error persists.

The response most likely means you have incorrect credentials, i.e., the server understood the request, but refused to authorize it.

You can reset the password by replacing the password hash stored in the MySQL database.

1 Like

Thank you.
This worked fine.

Do you know if database can be reused from one server to a new one.

I mean I did migration from one Ubuntu serve to Another.
I followed the steps for Ghost migration.

But data for members, comments etc is missing.

Is it possible to extract the old database. Import it to the new MySQL server and add it to the new ghost installation.

I did quick test with update of sudo nano config.production.json
Chaning the DB name and granting the users for the new DB.

But I got error:

Message: Ghost was able to start, but errored during boot with: Migration lock was never released or currently a migration is running.
Help: If you are sure no migration is running, check your data and if your database is in a broken state, you could run `yarn knex-migrator rollback`.
Suggestion: journalctl -u ghost_user3431-com -n 50
Stack: Error: Ghost was able to start, but errored during boot with: Migration lock was never released or currently a migration is running.
    at Server.<anonymous> (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:73:28)

Assuming no changes were done after the migration - no new posts, new comments etc.
I did table per table comparison and I found many differences.

I can upgrade manually most tables but wanted to be sure if there is a better way.

Actually the last one is more like:

Can I install new ghost installation using old DB?

My bad.
I was using tool to extract the DB - the tool extracted only the DDL without the data.
This resulted in the error above.

So old DB can be used for ghost.
Export and the import can be done by:

  1. Export from the old server:

mysqldump -u root -p ghost_prod > ghost_backup.sql

  1. The file can be transferred with FilleZilla.

  2. and import on the new one by:

mysql -u root -p ghost_prod < /home/user/ghost_backup.sql

  1. Then change in the

sudo nano config.production.json.

Changing only the DB name (or using ghost setup).

  1. You may need to add the ghost user rights for the new DB:

GRANT ALL PRIVILEGES ON ghost_prod.* TO 'ghost-11'@'localhost' with grant OPTION;

You can find nice guide for migration on this link: