Samba/Nextcloud share help

I installed DietPi to get a “preconfigured” Nextcloud install. I have a W10 NAS for all the shares, which are working fine for my Plex Media Server running on a headless Ubuntu server. However, Nextcloud is having issues with the mounted share (starting with just one share until I figure this out).

I set up a Samba share via drive_manager and it created the following fstab entry:

//192.168.1.180/george /mnt/george1 cifs username=nextcuser,password=[password],iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=3.1.1,_netdev,nofail,noauto,x-systemd.automount

Under /mnt, I now have the following entries:

root@DietPiNextCloud:/mnt# ls -rtl
total 8
drwxr-xr-x 2 root   root   4096 Jul 10 22:59 ftp_client
drwxrwx--- 2 dietpi dietpi    0 Jan  2 19:05 george1
drwxrwxr-x 8 dietpi dietpi 4096 Jan  7 21:20 dietpi_userdata

Browsing ‘george1’, I see all the files and folders on my NAS. So far, so good.

In Nextcloud, I installed the ‘External Storages’ app and tried to add the locally mounted drive ‘george1’ as a folder named ‘George2’. I used numbers to keep things straight as to what was being referenced no matter where I looked.


The green check means that Nextcloud can access the storage location.

Under External Storages, Nextcloud now shows the shared folder I created:
Image (2020-01-08; 15 13 58).png
However, when I click on ‘George2’, it doesn’t bring up the actual contents of the share on my NAS. Instead, I get this:


… which appears to be the contents of:

root@DietPiNextCloud:/mnt/dietpi_userdata/nextcloud_data/George/files# ls
 Documents  'Nextcloud intro.mp4'  'Nextcloud Manual.pdf'   Nextcloud.png   Photos

These are the default files and folders for each user created in Nextcloud.

Any idea what’s going on?

Hi,
this comes down to file system permissions. Because your webserver /Nextcloud is running under user “www-data” while your mount was done by user “dietpi”. Therefore you are not able to access the share. You can reconfigure your “external storage” within NextCloud Config to “/mnt/”. There you will see that you are not even able to see the folder. :sunglasses:

Solution could be to adjust your “fstab” to have the external storage mounted by user www-data

uid=www-data,gid=www-data

Thank you, thank you, thank you!!!

I had been struggling with this for some time now and that fixed it! Funny enough, late last night, I was wondering if I needed to do something with www-data or dietpi in the permissions SOMEWHERE, but wasn’t sure what or where. I’m not sure I would’ve gotten there. LOL. Once again, thank you so much!

In case anyone else comes across this, I wanted to add that you can’t just add mounts via fstab. I’m not sure what else drive_manager does, but it doesn’t appear to work without entering them via drive_manager. So, add them through that tool and then just modify each uid=dietpi and gid=dietpi to uid=www-data and gid=www-data.

hi,
as far as I know you could try to mount SMB/CIFS shares directly using NextCloud External Storage tool. So you could avoid to have them mounted to dietpi. But honestly I have no idea if this is working because I had some issues to set it up on my Demo VM. What I was able to get working, was WebDAV.

Thanks, Joulinar. I started down that route, but could never figure out exactly what the different boxes required and in what format. I won’t swear to it, but I also thought I recently read that the latest versions of Nextcloud and External Storages weren’t working 100%. I did have it working several versions ago in an appliance installation. Somehow, getting fstab working turned out to be easier now.

Now, I need to figure out what’s messed up with external access to Nextcloud, but that’ll be another thread.

Samba configuration, I followed this tutorial: https://www.mangladatech.com/2019/11/cara-konfigurasi-samba-server-di-debian.html