"EACCES: permission denied, copyfile" when uploading images after migrating images

hi, I created a blog on digital ocean and migrated content and images.
before uploading images.zip I renamed the existing folders that otherwise would have been overwritten, and then moved the files in the correct folders.

now I can’t upload images anymore because of EACCES: permission denied.

I did everything as root. I tried to solve with

chown ghost-mgr:ghost-mgr /var/www/ghost/.ghost-cli
chown ghost-mgr:ghost-mgr /var/www/ghost/config.production.json
sudo chown ghost-mgr:ghost-mgr /var/www/ghost/content/images/

but I was not able to solve, and I am now wondering I did something not good.

anyone can help here?

1 Like

Same issue. I also see it if I try and download a new theme, change the favicon, etc.

I have see the EACCES error as well as a EPERM: operation not permitted, copyfile ‘/tmp/6bd0f1eb65144d4a5e3b517e16687c2c_processed’ → ‘/var/lib/ghost/content/images/2021/09/filename.png’ depending on which of the tasks above I am doing.

I am using the docker images latest. I also tried using the two previous builds and same issue. I even tried the latest and a brand new fresh install (didn’t copy over my images or import my JSON) and I still see this error setting the favicon. It creates the 2021/09 folder directory in the images folder so it has write permissions to do that.

Connecting to the docker container I see everything is owned by the node user in my case (which the container seems to use). As node, I can write files to /tmp and copy them to the images and images/2021/09 directory just fine.

If I install a theme, I see a folder created in /tmp but nothing is inside it. t also creates a folder in the themes collection but nothing is inside it.

Last resort, I also tried doing a recursive chmod 777 and no change.

1 Like

I gave up on getting this to work and installed an S3 plugin.

I moved all my old blog images to S3 and now all new images will also upload to S3

Ran into that EACCESS error too when trying to upload images, after uploading my content folder on a new install, but did seem to get it resolved.
When I ran ghost doctor, it told me these:

1) Checking if logged in user is directory owner

Message: Your user does not own the directory /var/www/ghost and is also not a member of the owning group.
You must either log in with the user that owns the directory or add your user to the owning group.
Help: https://ghost.org/docs/install/ubuntu/#create-a-new-user

Create a new user

2) Checking current folder permissions

Message: The directory /var/www/ghost is not writable by your user. You must grant write access and try again.
Help: https://ghost.org/docs/install/ubuntu/#create-a-directory

Create a directory

3) Checking content folder ownership

Message: Your installation folder contains some directories or files with incorrect permissions:
[list]
Run sudo chown -R ghost:ghost ./content and try again.

Doing those seems to have resolved it for me.