I want to make a backup before updating it using the cli command ghost backup in the ghost directory /var/www/ghostblog . However i seem to hit a wall. I get an error that i dont understand it. Looking into the log file i thought that maybe the /ghost/api/admin/authentication/setup/ is blocked. So i made sure i unlock access to it from both nginx server and cloudflare. More specifically i made sure /ghost , /members , /webmentions , /email , /r/ are all reachable (because i usually lock access to them - as an extra security measure)
Below you can see the error messages i got after running the ghost backup command line.
Your input would be much appreciated.
Backing up site
An error occurred.
Message: ‘Response code 403 (Forbidden)’
It’s unclear exactly what you’re doing here, but to run ghost backup, access to the server via command line, i.e., SSH, is needed. You should not attempt this via HTTP or the proxy server, and certainly should not expose Ghost folders.
yep, the backup command was from ssh. ran the backup command with the user that has sudo privileges. the command i entered was ghost backup .
the 403 forbidden was outputed after being prompted by the ghost cli to enter the sudo password. my password was fine.
ghost doctor says everything is ok. the only thing that might not be proper is that it’s saying "ℹ Validating config [skipped]
"
regarding the urls mentioned, those are the urls i saw in the robots txt file and decided to just deny acces to them using cloudflare and nginx, so robots cant browse them.
this is the ghost doctor output
Checking system Node.js version - found v18.20.2
Checking logged in user
Ensuring user is not logged in as ghost user
Checking if logged in user is directory owner
Checking current folder permissions
Checking system compatibility
Checking for a MySQL installation
sudo systemctl is-active ghost_site.com
? Sudo Password [hidden]
Instance is currently running
Validating config [skipped]
Checking folder permissions
Checking file permissions
Checking content folder ownership
Checking memory availability
Checking binary dependencies
Checking free space
Checking systemd unit file
Checking systemd node version - found v18.20.2
i just saw that in the cloudflare logs there’s a request to /ghost/api/admin/authentication/setup/ when i run the backup command. this request is blocked by cloudflare…which seems odd to me.
that’s the url that is in the debug log i showed you in my main post
the user agent trying to o access that url is got/9.6.0 github.com/sindresorhus/got
do you know of it ? i dont understand it
so from what i gather, there’s an http request to that url /ghost/api/.. , by the script got 9.6.0 when i try to do the backup. is this supposed to happen ?
as a side note, my inbound rules on the server are set to deny for all ports. my computer ip and cloudflare’s proxy ip’s are the only allowed ones to access the server .
The config is skipped because Ghost is running. You should not be concerned with Nginx etc. since this isn’t relevant. Ghost uses Node, and this server is refusing to to run the backup because the user executing the command isn’t authorized to do so. Most likely you have a permissions issue.
Have you tried sudo ghost backup', and do the enter the correct credentials when prompted by ghost-cli`?
The content and member export tasks run within the backup command work by using the Admin API so the machine you’re running the command on will need full access to the API via the configured site URL. It sounds like you have something that is blocking that and returning the 403
Thank You for the help. @Kevin was on point with the concern i had. @mjw help is much appreciated as well. Problem solved
For others stumbling into similar situation here’s my note. i allowed the access to such requests , by using cloudflare’s waf > tools > then added my server’s ip address to allow list