When creating contents or uploading files from the Panel, I cannot do anything to the directory and files from ftp connection due to lack of permission. Is there a way to generate the files with different permission to also allow ftp account read/write access to them? It is a shared host without ssh service.
Maybe this helps: Content Folder Permissions on create
Thanks tex, but that doesn’t seem to fix my problem still getting permission denied for folders I created after the change.
Is there a way to chmod them using php?
You could try a hook that calls exec with chmod. But it might be a problem with the file owner rather than permissions, I would try to prevent using 777.
I tried to recursively run chown via php to give ownership to my ftp account but it makes the whole thing worse Now Kirby itself cannot read the content anymore and my ftp account cannot even browse inside the directory. Php can still print out the file names tho so they’re still there.
DIR:content/r-saga-2/system-generation FILE:content/r-saga-2/system-generation/pick_new_emperor.jpg FILE:content/r-saga-2/system-generation/gerard_crowning.jpg FILE:content/r-saga-2/system-generation/default.txt
The page turns out empty and the directory is now inaccessible to my ftp account.
I’m with @texnixe here: you’ve probably have a file ownership hickup in your server setup. The “ftp user” is preferably the same user (or group - depending on how you like to set this up) as your “www-user”.
If you screwed over file permissions and can’t access them any longer via FTP/SSH, I suggest to contact your hosting support and let them help you through this. I doubt this is Kirby related.
Contacted host, they point me to a tool in the vhcs2 control panel to fix permission. Everything is working now.
I think to prevent this from happening again I’ll use the Panel only on localhost and upload the results up to server.
Is the panel directory safe to remove?
Yes, if you don’t need the panel, you can remove the folder.
Thanks for your help everyone.