Fix permissions issues

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1277, #1273
| Refs tickets  | 
| License       | MIT
| Doc PR        | 

I have tested with and without this patch on a linux environment. I can replicate the issues in Linux without this patch, and they are fixed with this patch. I tried installation and viewing the admin panel.