Administration panel vs the CLI - permissions

I just installed Grav along with Administration Panel plugin. I am a new user, and is just running the default configuration with no additional stuff (beyond those admin depend on). My host is a vanilla Ubuntu 18.04 LTS and I have full access to the CLI (Command Line Interface), including sudo.

My main reason for exploring Grav is the claim that Grav was built with the command line in mind, while at the same time having a pretty spiffy Admin GUI plugin. I was hoping that Grav would let me switch between the CLI and GUI without much hassle. But so far, this works less smooth than it should.

My CLI user is named “joe”, and the web server group is named “www-data”.

I set the ownership and permissions for a regular page like this:

-rw-rw-r--   joe        www-data   default.md

This of course let me use nano to edit it from the CLI when logged in to the CLI as “joe”. Saving it after editing works fine, and the file permissions remain unchanged.

Opening this file for editing in the GUI also works fine because the web server runs with the permissions of the web server group. But after saving it from the GUI, ownership and permissions now look like this:

-rw-r--r--   www-data   www-data   default.md

I.e. ownership has changed from “joe” to “www-data” and there is no longer write access for the group. To edit it from the CLI, I first need to restore those.

This not only happens when editing pages. I can set up permission to do this as logged in on the CLI:

bin/grav cache

However, if I clear the cache just once from the GUI, ownership and permissions of the cache is changed, and I cannot use the CLI again to clear the cache without restoring those.

I hope this is not how things are supposed to be, and that there are some settings I’ve overlooked that stops Grav from changing ownership and permissions to files when used from the GUI.

Any help will be appreciated.