Skip to content

NC 12.0.3: Unable to mount SMB shares #6597

Description

@j-ed

Expected behavior

Nextcloud should be able to mount external SMB shares.

Current behavior

Nextcloud seems not able to always mount an external SMB share, provided via a Samba server, in a reliable way. The usual square in front of the share is displayed, which indicates an authentication problem, although all required information have been entered correctly. On top of the external mount screen the message "Verbindung zum Server verloren" (lost connection to server) is shown for a short moment.

I've double-checked that libsmbclient is installed and activated on the web server as recommended in other postings. Additionally I've tested access to the share using the smbclient command line tool:

# smbclient //192.168.1.11/Tmp -U "juergen"

Additionally I've written a small PHP script to check if the given SMB share can be accessed properly using the smbclient functions:

<?php
// Create new state:
$state = smbclient_state_new();

// Initialize the state with workgroup, username and password:
smbclient_state_init($state, '', 'juergen', 'XXXXX');

// Open a directory:
$dir = smbclient_opendir($state, 'smb://192.168.1.11/Tmp');

// Loop over the directory contents, print each node:
while (($entry = smbclient_readdir($state, $dir)) !== false) {
    echo "{$entry['name']} : {$entry['type']}<br>\n";
}

// Close the directory handle:
smbclient_closedir($state, $dir);

// Free the state:
smbclient_state_free($state);
?>

Everything works fine, except that it doesn't work from within Nextcloud :-( No error messages are shown in the Nextcloud log or elsewhere which gives a hint about the possible root cause of the problem.

Due to the fact that problems with external mount points appears very often I would recommend to add a kind of diagnosis function to each external mount function which allows double-check the base requirements and shows detailed information, including all steps of a mount attempt.

BTW: I've managed to created several identical mount configurations within seconds only by editing the SMB mount options of my test share. It seems that there is another issue with the external mount configuration dialog itself.

Steps to reproduce

  1. In my closed environment it is easy, but most likely in your test it isn't.

Environment

Server Configuration

OS: Linux 3.16.47
Web server: Apache2 2.4.26
PHP version: 5.6.29
Database: MariaDB 10.0.32
Nextcloud version: 12.0.3

Client Configuration

Browser: Mozilla Firefox 55.0.3
Operating system: Windows 7

Activity

  1. r3pek commented on Sep 21, 2017

    @r3pek

    From my upgrade from 11.x to 12.0.3 i had this problem too. problem was solved by entering the domain in the external mount options.

  2. j-ed commented on Sep 21, 2017

    @j-ed
    ContributorAuthor

    @r3pek Thanks for the hint but I tried it with and without a domain name, I used an ip address, the servers short and FQDN name, I've written the server name in upper and lower case, etc., etc. without any success. That's weird, isn't it?!

  3. r3pek commented on Sep 21, 2017

    @r3pek

    @j-ed sorry, maybe i wasn't clear enough ;)

    image

    I ment that "Domain" field. Not a "domain" in the "Host" field.

  4. j-ed commented on Sep 21, 2017

    @j-ed
    ContributorAuthor

    @r3pek Sorry, if it wasn't clear, I naturally tried it with the (Windows/Samba) domain name in the Domain field but it had not influence on the result.

  5. doc-jay commented on Oct 1, 2017

    @doc-jay

    smb server (CENTOS 7)
    nextcloud 12.03

    I had the same problem. I tested it all the same way j-ed did with 'smbclient' via the command line and it all passed. I fixed my problem by putting in my smb servers domain name (which was 'home') and it got the green light on my 'external storages' config where they were red after upgrading from 12.02 to 12.03.

    thanks

  6. j-ed commented on Oct 8, 2017

    @j-ed
    ContributorAuthor

    Today I've installed the smbwebclient.php script (https://sourceforge.net/projects/smbwebclient/files/) on my server and had also no problems to access files using SMB. What makes the Nextcloud app so specific that I cannot get it running?

  7. drhirn commented on Oct 9, 2017

    @drhirn

    Had problems too after setting server min protocol to SMB2 on my Samba server. After disabling this option, Nextcloud was able to mount shares again.

  8. j-ed commented on Oct 9, 2017

    @j-ed
    ContributorAuthor

    @drhirn I've tested it with the default of server min protocol = LANMAN1 and also with server min protocol = SMB2 as recommended in other discussions. Due to the fact that access is possible with the smbclient command line program and also with the smbclient php-functions outside of the Nextcloud environment I assume that there is still bug in the Nextcloud implementation.

  9. alexxy commented on Oct 22, 2017

    @alexxy

    I have same bug. Cannot mount samba shares anymore

  10. a-l-e-x-b commented on Oct 26, 2017

    @a-l-e-x-b

    Hi folks.
    I got the same issue connecting to my freenas smb share after updating to 12.0.3.
    Using "smbclient //192.168.11.121/myShare$ -U "myUser" " works fine.

    Neither using IP or name doesn't help nor providing domain/workgroup.

    My setup:
    OS: CentOS Linux release 7.4.1708 (Core)
    WebServer: httpd-2.4.6-67.el7.centos.6.x86_64
    Nextcloud: 12.0.3
    PHP: php70w-7.0.24-1.w7.x86_64

    NAS:
    Freenas 9.10.2 U6

    Sniffing traffic between NC and the NAS reveals the following message:

    20:23:05.410723 IP (tos 0x0, ttl 64, id 4498, offset 0, flags [DF], proto TCP (6), length 91)
    192.168.99.104.445 > 192.168.99.126.55666: Flags [P.], cksum 0x0d8b (correct), seq 766:805, ack 1274, win 1040, options [nop,nop,TS val 332947403 ecr 1373316036], length 39
    SMB PACKET: SMBtconX (REPLY)
    SMB Command = 0x75
    Error class = 0x22
    Error code = 49152 (0xc000)
    Flags1 = 0x88
    Flags2 = 0x3
    Tree ID = 65535 (0xffff)
    Proc ID = 17839 (0x45af)
    UID = 42148 (0xa4a4)
    MID = 6 (0x6)
    Word Count = 0 (0x0)
    NTError = STATUS_ACCESS_DENIED
    smb_bcc=0

    Havin' a look into the smbd log at the nas says:
    [2017/10/26 20:44:02.869547, 2, pid=35643, effective(0, 0), real(0, 0)] ../source3/smbd/service.c:319(create_connection_session_info)
    guest user (from session setup) not permitted to access this share (myShare$)

    Any help appreciated.

    Thanks in advance.
    Regards,
    Alex

  11. alexxy commented on Nov 1, 2017

    @alexxy

    Also its problem that its not possible to downgrade nextcloud to previos version (12.0.2 or so)

  12. nunocatarino commented on Nov 26, 2017

    @nunocatarino

    same bug here.

  13. tsopanid commented on Nov 27, 2017

    @tsopanid

    same here

  14. 51 remaining items

  15. kesselb commented on Feb 24, 2019

    @kesselb
    Contributor

    Did some tests with https://github.com/dperson/samba. Not sure if there is a general problem. Does it work for you if you test it with dperson/samba?

    docker run -it -p 139:139 -p 445:445 -d dperson/samba \
                -u "example1;badpass" \
                -u "example2;badpass" \
                -s "public;/share" \
                -s "users;/srv;no;no;no;example1,example2" \
                -s "example1 private share;/example1;no;no;no;example1" \
                -s "example2 private share;/example2;no;no;no;example2" \
                -p 
    
  16. pdschandler commented on Apr 29, 2019

    @pdschandler

    Hello - I've been doing a little searching so haven't gotten a chance to test thoroughly, but I'm also here because I'm not able to connect to an SMB share on my network, and it just so happens to be a share spun up from the https://github.com/dperson/samba Docker container mentioned above. I have other SMB shares on my network hosted by macOS and Windows, and all of those are accessible just fine,

    @kesselb did you discover any cause for not being able to connect to your containers from the dperson/samba container? I didn't think about this as a troubleshooting vector but I will now.

  17. kesselb commented on May 2, 2019

    @kesselb
    Contributor

    No. It does work for me just fine with the dperson/samba container.

  18. skjnldsv commented on May 10, 2019

    @skjnldsv
    Member

    No. It does work for me just fine with the dperson/samba container.

    I can't get it to work though, could you share your smb nextcloud config @kesselb please? :)

  19. pdschandler commented on May 10, 2019

    @pdschandler

    I figured it out - Nextcloud's smbclient uses SMB1 by default. You must either enable SMB1 on the Samba container or edit the Samba config in next loud to connect with SMB2.

  20. j-ed commented on May 13, 2019

    @j-ed
    ContributorAuthor

    @pdschandler Can you please describe what you mean with ...or edit the Samba config in nextcloud to connect with SMB2. Where and how do I need to set a parameter?

  21. skjnldsv commented on May 13, 2019

    @skjnldsv
    Member

    Add to /etc/samba/smb.conf into your php docker/container

    [global]
    client min protocol = SMB2
    client max protocol = SMB3 
    
  22. j-ed commented on May 13, 2019

    @j-ed
    ContributorAuthor

    @skjnldsv Yes, that's the configuration part if you want to set it for Samba in general. I'm interested in the mentioned Samba config in Nextcloud part. Have I missed a configuration option in Nextcloud?

  23. skjnldsv commented on May 13, 2019

    @skjnldsv
    Member

    AH, no idea. Though I can connect with the settings I added :)

  24. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jun 12, 2019
  25. KrullBorg commented on Dec 13, 2019

    @KrullBorg

    same here; latest nextcloud version; no attempt to connect to smb share, traced with tcpdump; no errors in nextcloud.log or apache error.log; it works using smbclient and mount

  26. wobblywob commented on Dec 18, 2019

    @wobblywob

    So, I had the same issue and tried every trick in the thread. For NC 17.0.1 this change fixed it for me link

  27. gmac0 commented on Jan 25, 2020

    @gmac0

    So, I had the same issue and tried every trick in the thread. For NC 17.0.1 this change fixed it for me link

    This fixed it for me as well. Thank you for finding that!

  28. skjnldsv commented on Mar 10, 2020

    @skjnldsv
    Member

    As the version of the software you've reported this for has reached end of life, I will close this ticket. If this is still happening after an upgrade to the latest version, feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions