Can't upload files since moving to VPS

I recently moved a Kirby powered website to a VPS (DigitalOcean) due to the ability to add a SSL certificate to the site.

But something is wrong with my configuration, because I can’t upload images (permission denied).

I am using a apache web server. The whole website has the owner/group:
www-data www-data

What about your php.ini settings? What are the values for


Ok, it turns out there are a couple of issues.

The upload issue is solved by increased the upload_max_filesize to 16MB

The remaining issue is much bigger:

I can’t edit files anymore due the fact that the website has the user/group: www-data www-data
Is there a solution that I can develop the site with my user and the panel works as well?

Do you mean working locally yourself and working on the live site via the panel? How did you transfer the files? If used SSH / Rysnc, perhaps you connected with the wrong user name to do it.

How do you deploy? I usually run a script that changes the permissions and user after upload if I upload with SFTP:

DIRS="assets content kirby site thumbs"

for dir in $DIRS;do
 sudo chown -R www-data.www-data "$dir"
 find "$dir" -type d -print0 | xargs -0r sudo chmod 775
 find "$dir" -type f -print0 | xargs -0r sudo chmod 664
 find "$dir" -type f \( -name *.pl -o -name *.cgi \) -print0 | xargs -0r sudo chmod 775

for file in $FILES;do
 sudo chown www-data.www-data "$file"
 sudo chmod 664 "$file"

exit 0;

Right know I develop locally and upload the edited files with SSH.
But this workflow is no longer working.

Should I change this workflow like clone the repo to the server and use your script?

I use this script manually if I upload via SFTP and via a post update hook if I deploy with git.

1 Like

If you use Rsync to deploy, using the correct username for connection, your problem will go away. Otherwise, your down to fixing perms/users after upload.

1 Like

@andalusi See my post here for smart way to do it.

Thanks @jimbobrjames for the link. Definitely worth diving into it!

But how was this permission issue managed on my shared hosting provider before moving to a VPS with root access?
Before I was able to change code locally and uploaded it via FTP without hassle …

Well shared hosting works differently. Things are kind of sandboxed, but now your on a VPS, full permissions come into play because you have full access to the box. Before, with shared hosting, you only had access to a folder on a server, so ownership didn’t really come into it, only file permissions.

1 Like

On side note, don’t use the root ssh account to transfer with rsysnc. You will screw the owner/group on your webroots folder which means you will probably get a 500 error when you try to look at the site. I dont know how this works on digital ocean, but on cPanel / WHM you use the username for account owner to ssh. Im sure Digital Oceans help files will tell what to use.

1 Like