syncloud / platform

Run popular services on your device with one click
https://syncloud.org
GNU General Public License v3.0
400 stars 40 forks source link

Nextcloud -> add SMB2/3 support #379

Closed szaimen closed 5 years ago

szaimen commented 5 years ago

Please add SMB2/3 support. Since Wannacry it is not longer recommended to use SMB1 and also disabled in Windows by default.

When I activate the SMB1-Server functionality on my Windows Server, I can acces my Windows network shares over the Nextcloud "External Storage" App. If I disable SMB1-Server-functionality, I cannot. That is the reason I am thinking SMB2/3 support is missing in Syncloud.

cyberb commented 5 years ago

Could you try changing smb level as adviced here: https://help.nextcloud.com/t/issues-with-nextcloud-13-and-smb-share

If that works we can fix it.

szaimen commented 5 years ago

I would like to do that but the file /etc/samba/smb.conf does not exist on my stock syncloud installation. What can I do now?

szaimen commented 5 years ago

It works now. I had to create the /etc/samba directory and have written the following into the smb.conf file:

[global] min protocol = SMB2 max protocol = SMB3 client min protocol = SMB2 client max protocol = SMB3

It was nice if you could integrate that into the Syncloud images.

szaimen commented 5 years ago

I was wrong: When I want to write to the SMB-Share over Nextcloud it says "An unknown error occurs" even though i can write with the same credentials from another PC to the network share. How can I fix that?

cyberb commented 5 years ago

Can you send us logs from settings so I can see what exactly nextcloud does not like?

Also they mentioned setting:

client min protocol = SMB2
szaimen commented 5 years ago

I have send you the logs from Syncloud -> Settings -> Support.

cyberb commented 5 years ago

Logs only show this error:

ERROR:  duplicate key value violates unique constraint "lock_key_index"

Not sure if it is related to smb. Could you uninstall amd install nextcloud to see if that helps?

szaimen commented 5 years ago

If I try to upload somenthing to my smb-share via nextcloud it just says: "unknown error occured". I reinstalled nextcloud but the error happens again.

cyberb commented 5 years ago

Could you try uploading and send logs again?

szaimen commented 5 years ago

The mail has been sent.

cyberb commented 5 years ago

Smb error:

Exception":"Icewind\\SMB\\Exception\\InvalidArgumentException","Message":"Invalid request for \/Download%20%281%29.jpg (InvalidArgumentException)","Code":22,

Could try also setting max to SMB2

As it helped someone here:

cyberb commented 5 years ago

Smb error:

Exception":"Icewind\\SMB\\Exception\\InvalidArgumentException","Message":"Invalid request for \/Download%20%281%29.jpg (InvalidArgumentException)","Code":22,

Could try also setting max to SMB2

As it helped someone here:

https://help.nextcloud.com/t/smb-external-storage-stops-working-solved/37927/2

szaimen commented 5 years ago

Yeah, I tried that but nothing changed. I have sent you the logs again.

cyberb commented 5 years ago

Can you do the same using smbclient tool? Probably it has nothing to do with nextcloud and all we need is a new version of smbclient.

szaimen commented 5 years ago

Do you mean mounting this network share with the cifs-utils?

I installed it, created /media/folder and added the following entry to /etc/fstab:

_//windows-pc/networkshare /media/folder cifs vers=3.0,username=windowsusername,password=windowspassword,iocharset=utf8,file_mode=0777,dirmode=0777 0 0

Afterwards I added /media/folder to my Nextcloud as local external storage.

Now I just need to know how to enable a cronjob to rescan the database in the background as described here: https://docs.nextcloud.com/server/15/admin_manual/configuration_files/external_storage_configuration_gui.html#adding-files-to-external-storages

sudo -u www-data php occ files:scan --all didn't worked out. I would appreciate your help with that.

cyberb commented 5 years ago

Here is how to run occ: https://github.com/syncloud/platform/wiki/Nextcloud

szaimen commented 5 years ago

Thank you! So to sum up and probably close the ticket:

I think, that Nextclouds external storage SMB Plugin is using natively the cifs-unix-extensions. However Windows Servers do not support this extensions as it is described in the first sentence here: https://wiki.ubuntuusers.de/Samba_Client_cifs/#Simulation-von-Rechten-ohne-cifs-UNIX-Erweiterungen So I cannot use the inbuilt SMB-Plugin when I want to write to a Windows-SMB2/3-Share. For connecting to Linux SMB2/3 shares (with disabled SMB1) editing the /etc/samba/smb.conf file should work.