Samba/Nextcloud share help Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
Skirge01
Posts: 10
Joined: Wed Jan 08, 2020 7:45 pm

Samba/Nextcloud share help

Post by Skirge01 »

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:

Code: Select all

//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:

Code: Select all

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.
Image (2020-01-08; 15 10 54).png
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
Image (2020-01-08; 15 13 58).png (6.92 KiB) Viewed 984 times
However, when I click on 'George2', it doesn't bring up the actual contents of the share on my NAS. Instead, I get this:
Image (2020-01-08; 15 16 02).png
... which appears to be the contents of:

Code: Select all

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?
User avatar
Joulinar
Posts: 2617
Joined: Sat Nov 16, 2019 12:49 am

Re: Samba/Nextcloud share help

Post by Joulinar »

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. 8)

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

Code: Select all

uid=www-data,gid=www-data
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Skirge01
Posts: 10
Joined: Wed Jan 08, 2020 7:45 pm

Re: Samba/Nextcloud share help

Post by Skirge01 »

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!
Skirge01
Posts: 10
Joined: Wed Jan 08, 2020 7:45 pm

Re: Samba/Nextcloud share help

Post by Skirge01 »

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.
User avatar
Joulinar
Posts: 2617
Joined: Sat Nov 16, 2019 12:49 am

Re: Samba/Nextcloud share help

Post by Joulinar »

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Skirge01
Posts: 10
Joined: Wed Jan 08, 2020 7:45 pm

Re: Samba/Nextcloud share help

Post by Skirge01 »

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.
mangladatech
Posts: 2
Joined: Mon Jan 13, 2020 8:00 pm

Re: Samba/Nextcloud share help

Post by mangladatech »

Samba configuration, I followed this tutorial: https://www.mangladatech.com/2019/11/ca ... ebian.html
Post Reply