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

**URL:** <https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078>\
**Category:** Self-hosting\
**Created:** [November 12, 2022, 10:00am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078 "2022-11-12T10:00:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johny\_K](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johny_k/32/10775_2.png) [@Johny\_K](https://forum.ghost.org/u/Johny_K)\
**Post date:** [November 12, 2022, 10:00am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/1 "2022-11-12T10:00:27Z")

</div>

When I try to run `ghost backup`

I got error:

```auto
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:

> <https://github.com/TryGhost/Ghost-CLI/blob/main/lib/commands/backup.js>

> **[Ghost-CLI - A fully loaded tool for installation and configuration](https://ghost.org/docs/ghost-cli/#ghost-backup)**
>
> The best way to install, manage, and update your site locally or when self-hosting Ghost. A full guide for our advanced CLI tool.

---

<div class="post-metadata">

**Author:** ![mjw](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mjw/32/30781_2.png) [@mjw](https://forum.ghost.org/u/mjw)\
**Post date:** [November 12, 2022, 10:06am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/2 "2022-11-12T10:06:28Z")

</div>

Run `ghost doctor`, and check for file permissions.

---

<div class="post-metadata">

**Author:** ![Johny\_K](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johny_k/32/10775_2.png) [@Johny\_K](https://forum.ghost.org/u/Johny_K)\
**Post date:** [November 12, 2022, 10:35am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/3 "2022-11-12T10:35:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mjw](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mjw/32/30781_2.png) [@mjw](https://forum.ghost.org/u/mjw)\
**Post date:** [November 12, 2022, 2:21pm UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/4 "2022-11-12T14:21:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Johny\_K](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johny_k/32/10775_2.png) [@Johny\_K](https://forum.ghost.org/u/Johny_K)\
**Post date:** [November 13, 2022, 10:32am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/5 "2022-11-13T10:32:44Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Johny\_K](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johny_k/32/10775_2.png) [@Johny\_K](https://forum.ghost.org/u/Johny_K)\
**Post date:** [November 13, 2022, 10:56am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/6 "2022-11-13T10:56:31Z")

</div>

Actually the last one is more like:

Can I install new ghost installation using old DB?

---

<div class="post-metadata">

**Author:** ![Johny\_K](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johny_k/32/10775_2.png) [@Johny\_K](https://forum.ghost.org/u/Johny_K)\
**Post date:** [November 14, 2022, 7:53am UTC](https://forum.ghost.org/t/ghost-backup-command-httperror-response-code-403-forbidden/34078/7 "2022-11-14T07:53:50Z")

</div>

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:

> [@Errors in moving ghost site to new server](https://forum.ghost.org/t/errors-in-moving-ghost-site-to-new-server/30974/9):
>
> I finally got it to work. I’ll write up the process and make a new post for anyone that has this similar problem but I need to get on with the weekend with the family. Basic process is this: Export Mysql database with mysqldump Copy content/images from old host Export your theme from old install Create New Server, eg, ubuntu on a vps Install ghost with the SAME version of your previous server, eg: ghost install 4.48.2 Drop newly created database from mysql then create empty database in Mysql …
