Folder and File Permissions before Upload

Hey everybody,

since I’m new to Kirby and want to upload my page very soon, I came along this issue:

On my Dev-Server I changed all Permissions to 777 to be able to work with Kirby. Now when I’m uploading my site and change the Permissions to 755 and 644 I had some Issues with Kirby not working correctly.
For example: I couldn’t use the Panel, when I set the writing rules on the media folder to 755 images are not able to load and so on…

I’m pretty sure it has something to do with the rights/permissions.

So I asked myself, what is the best way (if there is a way) to set the permissions before uploading the site on the live-server. And how can I be sure, that the permissions are set correctly.

Info:
I’m using Xampp on a Mac and for the permissions on the live-server I’m using the FTP-Client Filezilla.

Thank you for any advice!

You should better not set the permissions to 777 and just use Kirby as it is. Anyway, in order to reset them you could find all folders and files recursively with linux - How to change permissions for a folder and its subfolders/files in one step - Stack Overflow

As for development, I just use Laravel valet which also works for kirby out of the box. I’d recommend to use it to, so you don’t have to mess around with permissions.

Hey @glumanda,

thank you for your kind reply. For the next site I built I’ll definitely change my dev-tools. But since the deadline is quite close I think it would be better to reset the permissions with the stuff I’m using right now.

So just two short questions:

  1. is the basic permission setup for kirby folders 755 and for kirby files 644?

and

  1. Changing the permissions in Linux means I have to do set up my apache via terminal to do it, right? (Cause I’m using Xampp in a Folder.)

Thanks a lot!

The permissions you need really depend on the hosting environment you use.
For example, many shared hosting providers use “suEXEC” to let the PHP script run with the same user id as your shell user. So you could even set the permissions to 700 / 600 (or 755 / 644). This would kinda be the best IMO.

If however your webserver runs with a different user you either need to set the permissions accordingly. Depending on its group, either giving write permissions via the “group” or the “other” section to the webserver for directories and files that need it; from the top of my head: /content, /site/accounts, /site/cache, /site/sessions, /media.
So, if the webserver runs with a different user, 755 and 644 won’t be enough for those folders because those don’t give it write access. It either needs to be 775 / 664, or 777 / 666.

Hey,

sorry for the late answer.
I was able to solve the problem with an cronjob wich runs an permission-script on all the kirby files and folders. However, the server admin did this for me.

I think the best way to get this going is to not change the permissions in the first place and try to set up your dev-environment correctly.