SMB Nextcloud how?

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Hello,

I'm still a bit new to TrueNAS Core and I'm starting to despair.
Can someone maybe explain to me how to get the directory:
Code:
/usr/local/www/nextcloud/data/

for me as a user via SMB, so that you can simply copy the things to the PC?
Info: I have released the path in which the iocage is located completely via SMB. I only don't have permission for the Nextcloud path via SMB, but when I want to change that, TrueNAS tells me that I can't change that:
Code:
Error: [EFAULT] [EPERM] Changing permissions on jail dataset paths is not permitted: /mnt/Speicher/iocage/jails/NextCloud
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You should create the dataset external to the jail, e.g. "<pool>/share/nextcloud". Then mount this into the jail under /usr/local/www/nextcloud/data. This can be done in the jail configuration in the UI. Look for "mountpoints".
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
You should create the dataset external to the jail, e.g. "<pool>/share/nextcloud". Then mount this into the jail under /usr/local/www/nextcloud/data. This can be done in the jail configuration in the UI. Look for "mountpoints".
I can´t do this.
i can only in the iocage set a mointiongpoint


Nextcloud.png
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Source/Quelle should be a dataset outside of your jail. Destination/Ziel should be inside your jail.
 

asap2go

Patron
Joined
Jun 11, 2023
Messages
228
External storage local:
If you choose mnt/Speicher as Quelle and mnt/Speicher/iocage/jails/nextcloud/mnt/Speicher as Ziel you can use all oft your Speicher-Dataset as external local storage.
Make sure www user has access to the Dataset you want to share.

External storage SMB:
Activate SMB service and select a dataset (e.g. mnt/Speicher).
Then go to Nextcloud external storage and add it there.

If you use TN Core you probably need to enable smb in nextcloud first.

I'd go with the local option for TN Core.
And add a dataset or folder below Speicher AS you do not want to share all of it (like iocage).
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Externer Speicher lokal:
Wenn Sie mnt/Speicher als Quelle und mnt/Speicher/iocage/jails/nextcloud/mnt/Speicher als Ziel wählen, können Sie Ihren gesamten Speicher-Datensatz als externen lokalen Speicher verwenden.
Stellen Sie sicher, dass der WWW-Benutzer Zugriff auf den Datensatz hat, den Sie teilen möchten.

Externer Speicher SMB:
Aktivieren Sie den SMB-Dienst und wählen Sie einen Datensatz aus (z. B. mnt/Speicher).
Gehen Sie dann zum externen Speicher von Nextcloud und fügen Sie ihn dort hinzu.

Wenn Sie TN Core verwenden, müssen Sie SMB wahrscheinlich zuerst in nextcloud aktivieren.

Ich würde mich für die lokale Option für TN Core entscheiden.
Und fügen Sie unter „Speicher“ einen Datensatz oder Ordner hinzu, wenn Sie nicht alles freigeben möchten (z. B. iocage).
Ich überprüfe das echt nicht.

Eigentlich doch einfach, doch die Freigabe per SMB wird immer verweigert, mit der Info, dass dies nicht möglich sei.

Ich sehe ja den Ordner, habe aber keinen Zugriff darauf.

Unbenannt-2.png
 

asap2go

Patron
Joined
Jun 11, 2023
Messages
228
You cannot share a nextcloud infernal folder via SMB.
You can make a dataset in TrueNAS, share that dataset via SMB and add it as external storage in the nextcloud GUI.
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
You cannot share a nextcloud infernal folder via SMB.
You can make a dataset in TrueNAS, share that dataset via SMB and add it as external storage in the nextcloud GUI.
Thats great....

I came from omv and this system allow this... but the updates for nextcloud aur complicated.

so i think i learn more about TN
 

asap2go

Patron
Joined
Jun 11, 2023
Messages
228
Let me show you step by step.
First thing is go to Storage -> Pools:
1698073823374.png



There you probably already made a pool.
Just in case I'll show you.
Click on "Add":
1698073882722.png

Then Create new pool:
1698073913639.png


Add the disks in the layout you want. For example if you have 6 HDDs then go for one VDEV in a raidz2 config.
In case of 4 disks just make to mirrored VDEVs.
My virutal machine only has one drive so I just add that:
1698074296407.png

And hit create.

Now we have a pool, but we need a dataset to actually use it:

1698074376110.png


Let's just keep the defaults except ShareType. This should be set to SMB as we plan to share it later:
1698074461395.png


Then hit submit.

Now we are up and running with the basics.
If you already did all of that: Good.

Now what we want do is make our dataset accessible via SMB.
To do that we go to Services -> SMB -> start:
1698074653011.png


Then go to Sharing ->Windows Shares (SMB) and click add:
1698074712986.png


Select the dataset you want to share via SMB. Default options should be fine as they are. Then hit Submit.
1698074769312.png

It will tell you that it will auto enable the SMB service. Click okay you should now see the SMB share up and running:
1698074849974.png


Now we need a user that actually has access to the SMB share. So we go to Accounts -> Users -> Add:
1698075548407.png


select a username, a secure password that you want to use as authentification for SMB and under Directories and Permissions we select what dataset we want to have access to. In My case I jsut chose My_Dataset as it is the only one available:

1698075676781.png


Then click submit.
Now go to windows explorer, then right click on ThisPC -> map a network drive:
1698075857627.png


Then choose a Drive Letter and enter the location.
Be aware that your truenas system is simply called truenas instead of truenascore.
I just changed that because it would conflict with my real truenas.
Also select "Connect using different credentials". Because the user we created in TrueNas is not your Windows User which windows will attempt to login by default.

1698075872495.png



After you flick finish Windows will as you to enter the credentials:

1698075974111.png


Do that , click OK et voila:
1698076069313.png

SMB up and running.

Now for the NextCloud part.
Go To Plugins -> NextCloud -> Install -> choose a name and click Save.
Nextcloud will install:

1698076198172.png


After the Installation it should show as "up".

Now we have two methods to share files with nextcloud.
The first is the easy solution. External storage "local".
For this we need to stop nextcloud again:
1698076830154.png


Then click on Mount Points:
Actions -> Add:
1698076871418.png


Choose the dataset to share (in my case My_Dataset) under source and "mnt/My_Dataset" under Destination as target (you have to enter the "/My_Dataset" manually:

1698077488115.png


This way it will mount under nextcloud. Hit submit.
Go back to Jails -> Nextcloud -> Start.
Wait for it to start up and copy the address for the admin portal:

1698076589991.png


and login with the credentials you find under "Post Install Notes":

1698076646607.png


1698076686161.png


Now click on the "N" on the top right and choose Apps:

1698077162716.png


Scroll down until you find "External Storage support". Enable it:

1698077199768.png


Now go to Administration settings:

1698077230181.png


and choose External storage (under the Administration section. Not under Personal!):
1698077333037.png


Here we enter the Folder Name that NextCloud should display to the users. E.g. TrueNAS_Storage or just the name of the dataset (which I used)
Then the Storage Method "Local" and the path to the storage "/mnt/My_Dataset" which we defined in the Mount Points. You can also select which NextCloud users may access the folder:
1698077763593.png


Click on the Check arrow on the right and the entry should be marked green on the left side. This means everything works and NextCloud can access the dataset/folder.

Now you can access the files stored under My_Dataset via SMB from your windows PC and also from within nextcloud.

Second Method is SMB. Which is a bit trickier under TrueNAS Core.
First thing you would need to do is install the SMBclient in the NextCloud Jail via the serial console and I would have to loock up how to do that.
This might also come with a few caveats like additional system overhead.

Edit:
tried to install smbclient. Blew my NextCloud Install. Now nginx isn't starting anymore :D

Perhaps someone else can explain how to start SMB service under NextCloud Jail on Core.

If you get SMB working then the only difference is how you set up external storage.
Instead of choosing local you choose SMB/CIFS.
Enter the credentials of a user who has access to the share (e.g. the user we defined at the start)
Enter TRUENAS for Host
My_Dataset for Share
and any specific subfolder or subdataset if you want to restrict access to that.

1698078954886.png



It's quite late and there might be errors or practices which should be avoided.
If any of the more experienced users could point these out that'd be great :)
 

Attachments

  • 1698076499503.png
    1698076499503.png
    369.9 KB · Views: 93
  • 1698076957903.png
    1698076957903.png
    43.8 KB · Views: 74
  • 1698077096161.png
    1698077096161.png
    20.3 KB · Views: 67
  • 1698077288214.png
    1698077288214.png
    83.7 KB · Views: 64
  • 1698074592341.png
    1698074592341.png
    260 KB · Views: 88
Last edited:

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Let me show you step by step.
First thing is go to Storage -> Pools:
View attachment 71536


There you probably already made a pool.
Just in case I'll show you.
Click on "Add":
View attachment 71537
Then Create new pool:
View attachment 71538

Add the disks in the layout you want. For example if you have 6 HDDs then go for one VDEV in a raidz2 config.
In case of 4 disks just make to mirrored VDEVs.
My virutal machine only has one drive so I just add that:
View attachment 71540
And hit create.

Now we have a pool, but we need a dataset to actually use it:

View attachment 71541

Let's just keep the defaults except ShareType. This should be set to SMB as we plan to share it later:
View attachment 71542

Then hit submit.

Now we are up and running with the basics.
If you already did all of that: Good.

Now what we want do is make our dataset accessible via SMB.
To do that we go to Services -> SMB -> start:
View attachment 71544

Then go to Sharing ->Windows Shares (SMB) and click add:
View attachment 71545

Select the dataset you want to share via SMB. Default options should be fine as they are. Then hit Submit.
View attachment 71546
It will tell you that it will auto enable the SMB service. Click okay you should now see the SMB share up and running:
View attachment 71547

Now we need a user that actually has access to the SMB share. So we go to Accounts -> Users -> Add:
View attachment 71549

select a username, a secure password that you want to use as authentification for SMB and under Directories and Permissions we select what dataset we want to have access to. In My case I jsut chose My_Dataset as it is the only one available:

View attachment 71550

Then click submit.
Now go to windows explorer, then right click on ThisPC -> map a network drive:
View attachment 71551

Then choose a Drive Letter and enter the location.
Be aware that your truenas system is simply called truenas instead of truenascore.
I just changed that because it would conflict with my real truenas.
Also select "Connect using different credentials". Because the user we created in TrueNas is not your Windows User which windows will attempt to login by default.

View attachment 71552


After you flick finish Windows will as you to enter the credentials:

View attachment 71553

Do that , click OK et voila:
View attachment 71554
SMB up and running.

Now for the NextCloud part.
Go To Plugins -> NextCloud -> Install -> choose a name and click Save.
Nextcloud will install:

View attachment 71555

After the Installation it should show as "up".

Now we have two methods to share files with nextcloud.
The first is the easy solution. External storage "local".
For this we need to stop nextcloud again:
View attachment 71560

Then click on Mount Points:
Actions -> Add:
View attachment 71561

Choose the dataset to share (in my case My_Dataset) under source and "mnt/My_Dataset" under Destination as target (you have to enter the "/My_Dataset" manually:

View attachment 71569

This way it will mount under nextcloud. Hit submit.
Go back to Jails -> Nextcloud -> Start.
Wait for it to start up and copy the address for the admin portal:

View attachment 71557

and login with the credentials you find under "Post Install Notes":

View attachment 71558

View attachment 71559

Now click on the "N" on the top right and choose Apps:

View attachment 71564

Scroll down until you find "External Storage support". Enable it:

View attachment 71565

Now go to Administration settings:

View attachment 71566

and choose External storage (under the Administration section. Not under Personal!):
View attachment 71568

Here we enter the Folder Name that NextCloud should display to the users. E.g. TrueNAS_Storage or just the name of the dataset (which I used)
Then the Storage Method "Local" and the path to the storage "/mnt/My_Dataset" which we defined in the Mount Points. You can also select which NextCloud users may access the folder:
View attachment 71570

Click on the Check arrow on the right and the entry should be marked green on the left side. This means everything works and NextCloud can access the dataset/folder.

Now you can access the files stored under My_Dataset via SMB from your windows PC and also from within nextcloud.

Second Method is SMB. Which is a bit trickier under TrueNAS Core.
First thing you would need to do is install the SMBclient in the NextCloud Jail via the serial console and I would have to loock up how to do that.
This might also come with a few caveats like additional system overhead.

Edit:
tried to install smbclient. Blew my NextCloud Install. Now nginx isn't starting anymore :D

Perhaps someone else can explain how to start SMB service under NextCloud Jail on Core.

If you get SMB working then the only difference is how you set up external storage.
Instead of choosing local you choose SMB/CIFS.
Enter the credentials of a user who has access to the share (e.g. the user we defined at the start)
Enter TRUENAS for Host
My_Dataset for Share
and any specific subfolder or subdataset if you want to restrict access to that.

View attachment 71571


It's quite late and there might be errors or practices which should be avoided.
If any of the more experienced users could point these out that'd be great :)
Sorry but it dosnt work.

i see the Space but nothing loadet in this folder up.

its only loadet in "sofortupload" folder

wen i want manualy upload a picture i dont can upload any media
 

asap2go

Patron
Joined
Jun 11, 2023
Messages
228
Ah, Sry. Forgot to set permissions for Nextcloud. Because nextcloud is running under a systemuser called "www" that user needs permissions to access My_Dataset.
To do that we got to: Storage -> Pools -> My_Dataset -> Edit Permissions:

1698083470961.png


Scroll to the end of the list and click Add ACL Item:

1698083525229.png


Under Who* you select User
And in the User field you enter www. Permissions should be fine by default (Basic, Modify).
Check: Apply premissions recursively
And if you have more datasets below My_Dataset then also check apply permissions to child datasets:
1698083676911.png


Click Save and test if you can upload files. It should work now:

1698083741516.png
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Ah, Sry. Forgot to set permissions for Nextcloud. Because nextcloud is running under a systemuser called "www" that user needs permissions to access My_Dataset.
To do that we got to: Storage -> Pools -> My_Dataset -> Edit Permissions:

View attachment 71572

Scroll to the end of the list and click Add ACL Item:

View attachment 71573

Under Who* you select User
And in the User field you enter www. Permissions should be fine by default (Basic, Modify).
Check: Apply premissions recursively
And if you have more datasets below My_Dataset then also check apply permissions to child datasets:
View attachment 71574

Click Save and test if you can upload files. It should work now:

View attachment 71575
Perfect, this work... now i testing from my smartphone to upload
 

asap2go

Patron
Joined
Jun 11, 2023
Messages
228
Hope it works for you. I uploaded the corrected step by step guide here, in case you ever need it again:
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Hope it works for you. I uploaded the corrected step by step guide here, in case you ever need it again:
this way works perfekt.

info for other... wen i use the external folder, you must selst creat a folder for the upload folder. because the uploads are not per folder listed
 

TiboTake

Dabbler
Joined
Apr 13, 2016
Messages
42
Hope it works for you. I uploaded the corrected step by step guide here, in case you ever need it again:
I found a little Bug...

All User can See the Folders from other Users and all the Uploads... thats not good

for multiple Users you need for every user on montingpoint
 
Last edited:

Hemidactylus

Cadet
Joined
Oct 7, 2023
Messages
7
Salut @asap2go !

Je n'ai pas encore finalisé mon installation de Nextcloud, mais je pense voir tout de même quelques pistes d'amélioration :

- Attention de ne pas mélanger permissions et ACL, on utilise soit l'un, soit l'autre. Quand on utilise les ACL, on ignore les permissions.

- Il faut éviter de multiplier les accès en modification/écriture sur les fichiers, car cela risque de créer des problèmes de permissions.

- Pour cela, je conseille de travailler uniquement dans les permissions des datasets, de choisir en propriétaire et groupe propriétaire ton utilisateur Nextcloud (www:www, mais personnellement je vais utiliser un container Docker pour Nextcloud dans une autre VM, donc j'ai créé un utilisateur exprès), puis de ne conserver qu'une seule ACL en Full Control (ou Modify doit suffire aussi, il faut que je vérifie s'il a besoin de pouvoir modifier les ACL ou non) pour owner@.
Si ensuite tu veux monter tes partages autrement qu'avec Nextcloud, tu peux ajouter une ACL en lecture pour un groupe, dans lequel tu mets tes utilisateurs qui veulent par exemple monter les partages sous Windows.
Et pour modifier les fichiers depuis un ordinateur client, privilégier d'installer le client Nextcloud.


Ce sont quelques éléments, je n'ai pas encore configuré mon container Docker Nextcloud. Je reviendrai dire si tout est ok après.

------------------------------------------------------------------------------------
Hi @asap2go !

I have not yet finalized my installation of Nextcloud, but I still think I see some areas for improvement:

- Be careful not to mix permissions and ACLs, you use either one or the other. When using ACLs, ignore permissions.

- You should avoid having multiple modification/writing access to files, as this risks creating permissions problems.

- For this, I recommend working only in the permissions of the datasets, choosing your Nextcloud user in owner user and owner group (www:www, but personally I am going to use a Docker container for Nextcloud in another VM, so I created a user on purpose), then to keep only one ACL in Full Control (or Modify should be enough too, I need to check if it needs to be able to modify the ACLs or not) for owner@.
If you then want to mount your shares other than with Nextcloud, you can add a read ACL for a group, in which you put your users who want, for example, to mount the shares under Windows.
And to modify files from a client computer, choose to install the Nextcloud client.

TrueNAS Core - Permissions

These are a few things, I haven't configured my Nextcloud Docker container yet. I'll come back and say if everything is ok later.
 

Hemidactylus

Cadet
Joined
Oct 7, 2023
Messages
7
Hi,

Ok, my bad @asap2go, I have misinterpreted your post. In TrueNAS, everything is named permissions: Unix permissions and ACL, and it's confusing.

You definitely use only ACL, which is what I was talking about in my precedent message.

So, to be clear, an example with Nextcloud in a Docker container (with Nextcloud in Jail, it would be www:www in place of nextcloud) :

truenas_acl.png


And there is the user "download_read" to mount this share in Windows or something else, to not mess up the Unix permissions.

And for users home, this works great:
https://www.truenas.com/docs/core/coretutorials/sharing/smb/homeshare/
 

victort

Guru
Joined
Dec 31, 2021
Messages
973
You can create groups in nextcloud and allow only certain groups access to the folder. Or you can simply select which users have access to the folder. This is done in the administration settings.
 

Hemidactylus

Cadet
Joined
Oct 7, 2023
Messages
7
I read a lot in these forums about multiple access messing up the permissions, so I was thinking to have only one RW access for each dataset.
For information, I only have SMB datasets.
In this case, there is not much necessity for groups.

Nextcloud (in Docker) has an RW access to the datasets as external storage via SMB shares, and I can set up multimedia docker containers to have access to these folders in read only.

But it's a problem for me for certain datasets, because I have to write in them from Windows and Nextcloud. I can use the same TrueNAS user for these writing access, but I don't know if it can mess up the permissions, because Windows may works differently.

Plus, I don't know how will proceed Nextcloud when I will move files from one dataset to another from Nextcloud. Will it really move the file itself, or only update it's entry?
 
Top