Setup Permissions with NearlyFreeSpeech

Hi everyone,
Non-techie here trying to redo my personal page with Grav. I’m using NearlyFreeSpeech (NFS) and connecting through SSH with Filezilla 3.63.

I’ve copied over the Grav files to the root but I’m getting the “Fatal error : Uncaught RuntimeException:” for inability to write to security.yaml among others. From searching, it looks like the problem is a permissions problem. Grav said it would do a setup guide for NFS in 2014 but never completed/posted it. One forum user here gave up on trying to setup with NFS. A blogger said they got it working, but they don’t have any details or comment/contact method to find the details:

“The tricky thing about Grav is you need to enable web-group-writable permissions on the site, which can be problematic. Nearly Free Speech sensibly doesn’t allow this by default, so the installation process requires a little tweaking.”

Checking the folders/files through Filezilla, all Grav folders are set to 775 and files to 664, so it would seem that owner and group have read and write access in all cases.

I would appreciate any thoughts on getting it to work with NFS.

Thanks!

Update that will be relevant for anyone else trying to use NearlyFreeSpeech. I have made some progress but am still working on issues that are popping up.

Fixing the Runtime Exception:

The problem was not the octal for permissions of the owner and group. The issue is who is the default defined group with NFS.

Switching to WinSCP from FileZilla, I could see NFS defaults both the owner and the group to your individual account. To get Grav to work, the group needs to be set to web.

To do that, I used a command line window and ran the command:
chgrp web [grav location]
to change the group to web for all of the grav files.

This change alone got it to run. Setting up pages works.

New Problem - Temporary Files like Theme Custom Logos are Being Created With Web as Owner.

Now, my new problem is that certain temporary files are being created with web as the owner rather than my individual account. Grav then errors when trying to use the temp files because it says permission is denied.

The one example I’ve encountered so far is that Grav cannot update the theme custom logo. I made things worse by renaming a custom logo as the grav-logo.svg and just replacing the grav logo file. This broke my logo, and replacing the original grav-logo.svg file back in did not revert… Not sure what the deal is.

I have tried adding a setup.php file with both the below, but neither fixed it:
<?php
umask(0002);
and
<?php
umask(0);

Still trying to sort out how to fix this issue, if anyone has ideas.

1 Like

Okay. So, final update on this.

Update: New Problem - Temporary Files like Theme Custom Logos are Being Created With Web as Owner.

I have not been able to fix the file creation issue. Instead, I just brute forced it through the simplest solution I could think of. I just turned my logo into an SVG file, renamed it as the default, and replaced it in the themes/quark/images folder.

As a reminder, the problem was that the admin panel option to upload a custom logo did not work in NFS because the process involved creation of a temporary file with web as owner and group. This led to Grav erroring because it did not have permission to further manipulate the temporary file.

I ended up just brute forcing this the same way as replacing the favicon instead of attempting to redirect.

Besides from this issue, Grav otherwise seems to work. I have been able to create pages and sub-pages for blogging. The admin panel works well for these processes.


Conclusion: With some minor workarounds, it is workable to run Grav on NearlyFreeSpeech. If one follows the above steps, you should be up and running without issue.

1 Like