Unable to add and access SMB external mount; red square


#1

Introduction

I have a PC (Windows 10) with SMB shares enabled. I can access them locally from other PCs just by selecting my PC and inserting username and password, I have read-write rights.
PC local IP: 192.168.1.25
username: User
password: ******
shared directories: test, photos, public.

Steps to reproduce

  1. Start my pc (Windows 10) & test I can access SMB shares from my second PC (Windows 10)
  2. Open vmware and start owncloud VM
  3. open chrome and login into my owncloud server
  4. head to settings, external storage
  5. Add Storage; “SMB / CIFS”
  6. Insert my SMB credentials
  7. red square, red square after logout and login

Expected behaviour

I can access and browse my SMB shares

Actual behaviour

I cannot access my SMB shares.

Cause

I think I’m not inserting my SMB credentials correctly

  • Folder name: SMB
  • External storage: SMB / CIFS
  • Authentication: Username & Password
  • Host: 192.168.1.25
  • Share: test
  • Remote subfolder:
  • Domain:
  • Username: User
  • Password: ******

what am I inserting wrong? I just wonder about “share”, I just inserted the folder I want to access.
I’m starting to think something is wrong with SMB and ownCloud 10.0.10
Here another user reported:

Server configuration

Operating system: Win10 + vmware VM

Web server:

Database:

PHP version:

ownCloud version: (see ownCloud admin page) 10.0.10

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: owncloud.org


Setting Up Local (Same Server SMB Share)
#2

To Windows Users having hard times mouting their SMB Shares:
Apparently this is not working properly. I managed to mount my SMB shares, but it was an hard task and I still have wonders.

However, I did the following (dummy credentials):

  1. on your owncloud server machine or VM:

sudo apt-get install php-smbclient

  1. Windows 10 (Admin User: Jasper; Pass: Rock84)
  2. Nextcloud create user with admin rights.
  3. Windows 10: enable File & Printer shares; create a new folder called “Share”; share the folder:
    to do so: Select the folder you want to share, right click, properties, sharing tab, select “Advanced Sharing”, select “Share the folder”, press on “authorizations”, “Add…” - Jasper. OK.
  4. nextcloud, login, settings, external storage, SMB /CIFS with the following credentials:
    Host: 192.168.x.x
    Share: Share (Must be the shared folder’s name created in step 3)
    Subfolder:
    Domain: WORKGROUP
    User: Jasper
    Passwork: Rock84

If I change Share field to something different than the folder name, SMB share stop working and the green circle becomes red again. Share name MUST BE shared folder name.
If I leave Domain field empty, the green circle becomes red again.

If it doesn’t work, try to give you full control on your windows SMB shares (step 3) before pressing OK), try to match your Windows credentials with nextcloud credentials. The documentation on “external storage - SMB” is not sufficient to inform the user about all this. At least provide informations about what Windows users should input in the different fields (Share, Domain, etc.).

EDIT
I’m doing some testings:

  • Domain field must not be empty, it could be a letter or whatever you wish.
  • some of the instructions before the edit aren’t 100% necessary, but it’s a safe path to do some testings:
    • it’s probably not necessary to match nextcloud user and password with windows’s.
    • it’s probably not necessary to give full control to Jasper in SMB Win10 shares.
    • it’s probably not necessary to enable “SMB v.1 / CIFS” in “Windows features”.
  • Share field must be a shared folder’s name: if you share a folder called “Photos” and a folder called “Videos”, you have to add two SMB /CIFS external storages. You will need to add something like:

Name: SMB - Photos
Host: 192.168.x.x
Share: Photos (!)
Subfolder:
Domain: WORKGROUP
User: Jasper
Passwork: Rock84

Name: SMB - Videos
Host: 192.168.x.x
Share: Videos (!)
Subfolder:
Domain: WORKGROUP
User: Jasper
Passwork: Rock84

and if you want to share Photos/Hawaii, either share the Hawaii folder itself from windows and add it as it is shown above or, even better:

Name: SMB - Photos: Hawaii
Host: 192.168.x.x
Share: Photos
Subfolder:Hawaii
Domain: WORKGROUP
User: Jasper
Passwork: Rock84

Note that in some cases (VM) to share Hawaii folder I had to:

Share: Photos/Hawaii
Subfolder:

Note that in some cases (VM) it’s not possible to share a storage drive directly (e.g. E:/), but you:

  • need to create a subfolder and share that specific folder (e.g. E:/Data), so you need to have:
    • Name: SMB - Data
      Host: 192.168.x.x
      Share: Data (!)
      Subfolder:
      Domain: WORKGROUP
      User: Jasper
      Passwork: Rock84
  • you share E:/ but you will still be able to access a single subfolder per share, so you need to have:
    • Name: SMB - E
      Host: 192.168.x.x
      Share: E/Data (!)
      Subfolder:
      Domain: WORKGROUP
      User: Jasper
      Passwork: Rock84

Please, feel free to correct whatever demonstrates to be incorrect and to add some other strategies to ease the process.


#3

Works for me with ownCloud 10.0.10 connecting to a windows 10



52

  • Use the libsmbclient-php library, and make sure it’s used by apache.
  • The default target protocol depends on the libsmbclient version. I think newer version have switched to SMB2 by default. Older versions use SMB1. If you’re using an old version, there are guides about how you can configure the client to use SMB2
  • SMB2 might require you to use a domain. Most of the times, any domain will work (probably dependant on domain controllers being present in the system)

All of this it’s outside of ownCloud’s control, and it’s part of your setup. There are also configuration in the windows’ side that could affect the connection (SMB1 protocol enabled or not, for example)

That’s your windows problem allowing anonymous access to the share. If the authentication fails, the libsmbclient tries to connect anonymously. If you don’t want to allow anonymous access to the windows machine, fix it in windows and make it refuse anonymous connections.


#4

I managed to get it working, as per post #2. I use libsmbclient-php, I have to use both SMB2 and SMB1 for different applications; owncloud requires me to insert a domain field.

In the manual/documentation they should improve the explanation on how to connect SMB shares (particularly Windows shares), because at the moment the explanation provided Here is not that clear for Windows users. Something like the first screenshot you attached would be enough already. In the admin manual I linked, in the last explanatory screenshot they fill “Share” field with “users”. That’s kind of misleading, using a folder called “users” in this context wasn’t the smartest idea probably.

What you quoted is not from me, you are quoting the guy I also quoted in my first post, and you probably misunderstood what you quoted. He has not allowed anonymous access, on the other hand his nextcloud server prevents him from logging in with wrong credentials, which is just the desired behavior.
Thanks for the explanatory screenshots you posted!


#5

The desired behaviour is that WINDOWS blocks the log in. ownCloud doesn’t have any idea whether the credentials you’ve put are right or wrong, it just send them. If windows accepts those credentials, it’s just windows’ fault.

Windows has a ton of feature people barely knows about. You can check https://github.com/owncloud/core/issues/30153 that one of those was affecting the behaviour of the SMB connection. I wouldn’t be surprised if there is another one messing around.


#6

of course! but again, in your quote that guy just asserted what you just said:

since:

WINDOWS blocks the log in

And the consequence to this is nextcloud showing the red square.

When I said

I should have expressed that it is Windows preventing his access and nextcloud communicated this denial through the red square icon.

but no,

there’s not anonymous access allowed.