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.

2 Likes

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

Hi there, I am also trying to setup grav on NFS, and I seem to be running into the same issue as you. I ran this command and it didn’t seem to fix the Runtime Exception issue for me. This is how I typed the command, and the result it gave me:

$ chgrp web /simsblog
chgrp: /simsblog: No such file or directory

I checked several times to see if I typed the directory name correctly. I also tried typing it as “home/public/simsblog” but that also doesn’t seem to do anything.

Do you have any other details on how you got it working? I’d appreciate the help as I’m quite new to this…

$ chgrp web /simsblog
chgrp: /simsblog: No such file or directory

I checked several times to see if I typed the directory name correctly. I also tried typing it as “home/public/simsblog” but that also doesn’t seem to do anything.

Remove the forwardslash and see if that resolves your issue. Navigate to your public directory where the simsblog directory it and then run the command chgrp web simsblog

1 Like

Thank you for the advice!

The other problem that I was having is that when using this command, it only changed permissions for the directory, but not for the files within. So I had to run chgrp -R web simsblog and it finally got past the fatal error…

Glad you got it to work. I am still sorting it all out myself.

As a warning, do not attempt to upgrade Grav or the admin plugin through the admin panel until you sort it all out. I tried to do that with 1.7.40 and it killed the admin page/panel. I ended up have to recopy the plugin files.

I have been running into the issue that the Grav generated files (updates/logos) are being created with web as both owner and group. I wasn’t able to get the setup.php file with umask to work, but that seems to be the issue. I am still trying to sort that one out. Let me know if you end up resolving that.