0

I am having permission issue using Grav cms. Grav file system requires write access to their cache folders. The storage device that has the grav sites is on an external usb drive connected to a different server from the webserver (nginx) which is hosting it. The webserver is connected via samba and is mounted using fstab. I am able to connect to the usb storage drive and can r+w+exec to it. However, when I access the site via the browser it throws a 500, blank screen, permission denied errors.

Server Error
Sorry, something went terribly wrong!

0 - The directory "/mnt/www/ktravel/cache/doctrine/6333572e" does not exist and could not be created.

This is the line I have in the fstab file where uid is www-data and guid is logInUser.

//192.168.1.25/www /mnt/www cifs guest,rw,file_mode=0775,dir_mode=0775,uid=33,gid=1001 0 0

This is the permission in the folder.

ls -ls
total 12288
1024 -rwxrwxr-x 1 www-data ws1 138329 Dec  7 07:15 CHANGELOG.md
1024 -rwxrwxr-x 1 www-data ws1   3216 Dec  7 07:15 CODE_OF_CONDUCT.md
1024 -rwxrwxr-x 1 www-data ws1   7098 Dec  7 07:15 CONTRIBUTING.md
1024 -rwxrwxr-x 1 www-data ws1   1071 Dec  7 07:15 LICENSE.txt
1024 -rwxrwxr-x 1 www-data ws1   6701 Dec  7 07:15 README.md
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 assets
   0 drwxrwxr-x 2 www-data ws1      0 Mar  1  2018 backup
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 bin
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:18 cache
1024 -rwxrwxr-x 1 www-data ws1   3848 Dec  7 07:15 composer.json
1024 -rwxrwxr-x 1 www-data ws1 200025 Dec  7 07:15 composer.lock
   0 drwxrwxr-x 2 www-data ws1      0 Aug  9 15:59 git
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:17 images
1024 -rwxrwxr-x 1 www-data ws1   1690 Dec  7 07:15 index.php
1024 -rwxrwxr-x 1 www-data ws1     74 Oct 30 11:55 info.php
   0 drwxrwxr-x 2 www-data ws1      0 Jul  6 10:21 logs
1024 -rwxrwxr-x 1 www-data ws1     76 Dec  7 07:15 now.json
1024 -rwxrwxr-x 1 www-data ws1    197 Feb 15  2018 robots.txt
1024 -rwxrwxr-x 1 www-data ws1     19 Dec 22 12:10 setup.php
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 system
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 tmp
   0 drwxrwxr-x 2 www-data ws1      0 Dec  1  2018 user
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 vendor
   0 drwxrwxr-x 2 www-data ws1      0 Dec  7 07:15 webserver-configs
3
  • 1
    I'm surmising that what you have is the /mnt/www/ktravel directory and it's supposed to create cache/doctrine/6333572e inside. As it is mounted via samba, do the smb permissions on the machine where the USB drive is located allow the www-data user to write to it? Why not just make it easier and put the document root with the Grav sites on the machine with Nginx so that you don't have to mess with any of that? Commented Dec 24, 2019 at 0:29
  • @NasirRiley That was how the drive is connected before and I had no issue. The server is running off of a rpi 3 and it has Plex media server installed along side. I wanted Plex to be on it's own os and purchased another rpi. That is why I had to move my usb drive to the new rpi.
    – ducsu
    Commented Dec 24, 2019 at 0:49
  • 1
    You mention you can connect to the usb drive and change permissions, but have you tried to simulate what nginx did with the www-data user from the web server? Try sudo -u www-data mkdir /mnt/www/ktravel/cache/doctrine/6333572e and see if it works. If not you may need to fix permissions somewhere in that path, as @NasirRiley pointed out.
    – Zip
    Commented Dec 24, 2019 at 0:50

1 Answer 1

0

This question by @Nasir Riley got me thinking.

As it is mounted via samba, do the smb permissions on the machine where the USB drive is located allow the www-data user to write to it?

The answer is No.

In my smb.conf file, I added www-data and ws1 users to these lines.

www-data allowed write permission in the webserver.

ws1 allowed write permission in Windows.

[www]
comment = websites
path = /mnt/www
force user = www-data
force group = ws1
writeable = yes
browseable = yes
public = yes
create mask = 0775
directory mask = 0775
guest ok = yes
guest only = yes 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .