Permissions error?

Not sure how much this is due to Hugo or something else.
I recently moved my site to a new server, and now I am getting this errror:

Error copying static files: chmod /var/www/ operation not permitted

I was double checking the permissions, but they look good:

drwxrwxr-x 14 www-data www-data 4.0K Jul  8 13:19 www

drwxrwxr-x 40 www-data www-data 4.0K Jul  8 10:02

What am I missing here?

This happens after running hugo on your new server?

Did you check the permissions of that specific file?

Okay I figured it out. The file had the wrong owner. Here’s how I solved it:

root@DeLorean:/var/www# chmod 755
root@DeLorean:/var/www# find -type f -exec chmod 644 {} \;
root@DeLorean:/var/www# chown -R doc:www-data

In my case, the user doc is used to run Hugo and I had the directory as belonging to the www-data user.

1 Like