File permissions

Hi!

After I upload files and try to edit via Panel, I get the error:

The page is not writable
Please check the permissions for the content folder and all files.

I tried changing to 644 and 664, but the error persists. Only way to make it work is by setting all to 777.

How risky would it be to leave them all at 777? Any ideas what could be happening here?

Thanks!

Check the owner of your files, your server must be able to write in your folders.

Never keep 777 on your files/folders for security reasons.

If you have access to your server use these commands:

# change owner for all your Kirby files and folders:  root > www-data (I suppose www-data is your web user)
sudo chown -R www-data:www-data *

# change right on all your Kirby files and folders
sudo find /var/www/ -type d -exec chmod 755 {} +
sudo find /var/www/ -type f -exec chmod 644 {} +

In this case “www-data” is the user name used by the server and /var/www/ is the path of your web root folder
If your server has another user name replace “www-data” by your server user name, same for the root path.

3 Likes

Thanks! By doing ls -l it shows that the user is root. Do I need to create a user for the server? Or what’s the next step? :slight_smile:

Your server has already its own user name. Which webserver do you use ? Apache, Nginx, Caddy … ?

Your server name is probably “www-data”, you can check if this user exist on your system with the command :

sudo nano /etc/passwd

“nano” is an editor and must be installed on your server.
you can also use “gedit” or “vi”

That tells you that the files are currently owned by the root user. Now depending on what user name the web server is running under, you have to change this ownership from root to the web server user.

Thanks @gillesvauvarin! That did the trick. I use Apache and the user is www-data. WIth your commands I was able to resolve this issue.

One little step completed, of the hundreds to be done to publish our website… :smiley: