How to fix permission denied in Ghost packaged by Bitnami

Learn how to fix the "Cannot upload image" error in your Ghost blog packaged by Bitnami

How to fix permission denied in Ghost packaged by Bitnami

Are you dealing with a Cannot upload image error in your Ghost packaged by Bitnami? Keep reading to learn how to fix it in a few seconds

What error is? 🚨

When you try to upload any image, the server responds with:

{
  "errors": [
    {
      "message":"Internal server error, cannot upload image.",
      "context":"EACCES: permission denied, mkdir '/opt/bitnami/ghost/content/images/2021/10'",
      "type":"InternalServerError",
      "details":null,
      "property":null,
      "help":null,
      "code":"EACCES",
      "id":"660baf30-1de9-11ec-906a-8dcde4a8621e"
    }
  ]
}

What is your content path? 🗺

Before apply the fix, you need to know where is the content folder. Usually, it is "/opt/bitnami/ghost/content" but you should verify it

In order to verify it, take a look to your config.production.json file:

cat /opt/bitnami/ghost/config.production.json

At the bottom of the file, you will find it

...
"paths": {
  "contentPath": "/opt/bitnami/ghost/content"
}
...

Copy the contentPath property value: "/opt/bitnami/ghost/content"

💡 If you can not find the config file, search it with the command:

find -L / -name "config.production.json"

How to fix the Permission Denied in Ghost ✅

Allow to read, write and execute in the images folder

sudo chmod 777 /opt/bitnami/ghost/content/images

Add ghost user as owner of the folder

sudo chown -R ghost:ghost /opt/bitnami/ghost/content/images

Restart to apply changes

sudo /opt/bitnami/ctlscript.sh restart

💡 Remember to change the path in the previous commands if your content path is different

Write your Ghost blog success 🚀

Give a try to Ghostboard without any risk: start now your 14 days free trial without a credit card, check it out by yourself 🙂

Ghostboard.io

Happy to help you and answer any question, tweet us, or contact us in your dashboard! 👋